**Describe the bug**

The query:
```
SELECT
    (current_database = currentDatabase()) AND (type = 0),
    ((current_database = currentDatabase()) AND (type = NULL)) AND (type = NULL) AND ((current_database = currentDatabase()) AND (type = 1048575)) AND (type = NULL) AND (event_date >= yesterday())
FROM system.query_log
ARRAY JOIN ProfileEvents
WHERE ProfileEvents AND (current_database = currentDatabase())
ORDER BY event_time DESC NULLS FIRST
LIMIT 0
```
crashes the server.

Most likely introduced here: #16618
ManyExpressionActions & order_by_elements_actions)
{
    const auto * select_query = getSelectQuery();
    if (!select_query->orderBy())
    {
        auto actions = chain.getLastActions();
        chain.addStep();
        return actions;
    }
    ExpressionActionsChain::Step & step = chain.lastStep(aggregated_columns);
    getRootActions(select_query->orderBy(), only_types, step.actions());
    bool with_fill = false;
    NameSet order_by_keys;
    for (auto & child : select_query->orderBy()->children)