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

Commit 7bdeca44 authored by Greg Kaiser's avatar Greg Kaiser
Browse files

XmlBlock: Avoid potential NULL dereference

We move our dereference after the NULL check.

Test: TreeHugger
Change-Id: I8334be8faf67752e9c0dddf97b133b92b4a7f345
parent 12d08fd3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -81,12 +81,12 @@ static jlong android_content_XmlBlock_nativeCreateParseState(JNIEnv* env, jobjec
    }

    ResXMLParser* st = new ResXMLParser(*osb);
    st->setSourceResourceId(res_id);
    if (st == NULL) {
        jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
        return 0;
    }

    st->setSourceResourceId(res_id);
    st->restart();

    return reinterpret_cast<jlong>(st);