v.22.5Bug Fix

Fix nullptr dereference in JOIN and COLUMNS matcher

Fix nullptr dereference in JOIN and COLUMNS matcher. This fixes #36416. This is for https://github.com/ClickHouse/ClickHouse/pull/36417. #36430 (Amos Bird).