[3.11] gh-102281: Fix potential nullptr dereference + use of uninitia… (#103040)

[3.11] gh-102281: Fix potential nullptr dereference + use of uninitialized memory (gh-102282)
(cherry picked from commit afa6092ee4260bacf7bc11905466e4c3f8556cbb)
3 files changed