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

Commit 4d9fccf0 authored by Ashish Kumar Gupta's avatar Ashish Kumar Gupta
Browse files

Missing NULL Check

Add a safety NULL check in case of MtpDataPacket::putString() gets called with nullptr as argument.

Bug: 244030143
Change-Id: Ia50e6b4f060a1d9414f89201bf812caa66f1a1cc
Test: presubmit
parent 235b91c5
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -420,9 +420,11 @@ void MtpDataPacket::putString(const MtpStringBuffer& string) {
}

void MtpDataPacket::putString(const char* s) {
    if (s != NULL) {
        MtpStringBuffer string(s);
        string.writeToPacket(this);
    }
}

void MtpDataPacket::putString(const uint16_t* string) {
    int count = 0;