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

Commit df0adbbb authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am 2098517e: make sure Parcel handles 0-sized LightFlatenables

* commit '2098517e':
  make sure Parcel handles 0-sized LightFlatenables
parents a2de8585 2098517e
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -285,10 +285,13 @@ status_t Parcel::write(const LightFlattenable<T>& val) {
            return err;
        }
    }
    if (size) {
        void* buffer = writeInplace(size);
        return buffer == NULL ? NO_MEMORY :
                val.flatten(buffer);
    }
    return NO_ERROR;
}

template<typename T>
status_t Parcel::read(LightFlattenable<T>& val) const {
@@ -303,10 +306,13 @@ status_t Parcel::read(LightFlattenable<T>& val) const {
        }
        size = s;
    }
    if (size) {
        void const* buffer = readInplace(size);
        return buffer == NULL ? NO_MEMORY :
                val.unflatten(buffer, size);
    }
    return NO_ERROR;
}

// ---------------------------------------------------------------------------