Checking for tok != nullptr is either not necessary here, or it will crash in the else if (l. 7424) nevertheless.