Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28df640f authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Creates a dummy pointer for empty messages

Changes to Java HIDL at ContextHubService caused empty messages with
sendMessageToHub to be populated with null pointers. Work around this by
creating a dummy pointer in this case.

Bug: 69065562
Test: Compile on sailfish-userdebug, run CHQTS and verify pass
Change-Id: I763cbf9696f6dc04637add3ed1da01f9c32d458b
parent c8145123
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -155,6 +155,12 @@ Return<Result> Contexthub::sendMessageToHub(uint32_t hubId,
        .message = static_cast<const uint8_t *>(msg.msg.data()),
    };

    // Use a dummy to prevent send_message with empty message from failing prematurely
    static uint8_t dummy;
    if (txMsg.message_len == 0 && txMsg.message == nullptr) {
        txMsg.message = &dummy;
    }

    ALOGI("Sending msg of type %" PRIu32 ", size %" PRIu32 " to app 0x%" PRIx64,
          txMsg.message_type,
          txMsg.message_len,