Fix for possible null reference exception when resizing terminal [#84344418]

@sinan, can you merge this fix?