[SurfaceFlinger] Checking nullptr for HWC layer.

There were several places where we didn't check nullptr when accessing HWC
layer, which results in function call on nullptr when external display was
disconnected. This patch makes sure we check HWC layer before calling functions
on it.

BUG: 80325674
Test: Build, flash, boot
Change-Id: I302ad4eeea5c196daadcdccb596dac60b02d3845
Merged-In: I302ad4eeea5c196daadcdccb596dac60b02d3845
3 files changed