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

Commit 4b2d0f20 authored by Adam Lesinski's avatar Adam Lesinski
Browse files

Fix crash in ResStringPool

When a String isn't found in the StringPool,
we should not try to construct a String8 object
from the NULL string.

Bug:15163956
Change-Id: I51e701918b10a72c18a860b8a36dce2afd9c0b82
parent 82d6d337
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -802,11 +802,16 @@ const char* ResStringPool::string8At(size_t idx, size_t* outLen) const
const String8 ResStringPool::string8ObjectAt(size_t idx) const
{
    size_t len;
    const char *str = (const char*)string8At(idx, &len);
    const char *str = string8At(idx, &len);
    if (str != NULL) {
        return String8(str);
        return String8(str, len);
    }
    return String8(stringAt(idx, &len));

    const char16_t *str16 = stringAt(idx, &len);
    if (str16 != NULL) {
        return String8(str16, len);
    }
    return String8();
}

const ResStringPool_span* ResStringPool::styleAt(const ResStringPool_ref& ref) const