graphics: early return in CommandWriterBase::writeQueue

When there is no data to be written, return early.

Bug: 67512553
Test: manual
Change-Id: I4e8dc72ec22293fac7a84b38c98e29d5cf7f78b6
diff --git a/graphics/composer/2.1/default/IComposerCommandBuffer.h b/graphics/composer/2.1/default/IComposerCommandBuffer.h
index 058709c..c752f8a 100644
--- a/graphics/composer/2.1/default/IComposerCommandBuffer.h
+++ b/graphics/composer/2.1/default/IComposerCommandBuffer.h
@@ -92,6 +92,13 @@
     bool writeQueue(bool* outQueueChanged, uint32_t* outCommandLength,
             hidl_vec<hidl_handle>* outCommandHandles)
     {
+        if (mDataWritten == 0) {
+            *outQueueChanged = false;
+            *outCommandLength = 0;
+            outCommandHandles->setToExternal(nullptr, 0);
+            return true;
+        }
+
         // After data are written to the queue, it may not be read by the
         // remote reader when
         //