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

Commit bf974a37 authored by Greg Kaiser's avatar Greg Kaiser
Browse files

KeyCharacterMap: Avoid null dereference

We move around our null check of 'map' to be prior to the
dereference.

Test: TreeHugger
Change-Id: I13b8a15e26f5d01c29f714492c84c0d5ce86a580
parent ed141331
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -101,11 +101,11 @@ static jlong nativeReadFromParcel(JNIEnv *env, jobject clazz, jobject parcelObj)
static void nativeWriteToParcel(JNIEnv* env, jobject clazz, jlong ptr, jobject parcelObj) {
    NativeKeyCharacterMap* map = reinterpret_cast<NativeKeyCharacterMap*>(ptr);
    Parcel* parcel = parcelForJavaObject(env, parcelObj);
    if (!parcel) {
    if (!parcel || !map) {
        return;
    }
    parcel->writeInt32(map->getDeviceId());
    if (!map || !map->getMap()) {
    if (!map->getMap()) {
        parcel->writeBool(false);
        return;
    }