Fix null pointer dereferencing in TWGBP

Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice

Bug: 64227158
Bug: 64495583
Change-Id: I3bcab37346d5d7de31a7c24b2951b3501fa9858f
2 files changed