gh-95355: Check tokens[0] after allocating memory (GH-95356)


GH-95355

Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit b946f529efb4a623ac4ad968d8091edb81ebdcdb)

Co-authored-by: Honglin Zhu <zhuhonglin.zhl@alibaba-inc.com>
2 files changed