Use the null check properly

Test: m cts && cts-tradefed run cts -m CtsMediaTestCases \
-t android.media.cts.DecoderTest

Bug: 112129800
Change-Id: I27aaf933fbb1e99c0c7310d704d0bceac24b4d1e
diff --git a/codec2/hidl/client/client.cpp b/codec2/hidl/client/client.cpp
index 9a82712..a0340a6 100644
--- a/codec2/hidl/client/client.cpp
+++ b/codec2/hidl/client/client.cpp
@@ -189,9 +189,10 @@
                             continue;
                         }
                         if (!heapParams) {
-                            ALOGW("query -- extra stack param.");
+                            ALOGW("query -- unexpected extra stack param.");
+                        } else {
+                            heapParams->emplace_back(C2Param::Copy(*paramPointer));
                         }
-                        heapParams->emplace_back(C2Param::Copy(*paramPointer));
                     }
                     ++it;
                 }