diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp index 09bb4aaff8295bb7c7af6814573333af83805c6e..27d3d375b982c83dd7877e0a605f52e7450fafab 100644 --- a/base/src/parcel.cpp +++ b/base/src/parcel.cpp @@ -776,6 +776,10 @@ bool Parcel::Read(T &value) size_t desireCapacity = sizeof(T); if (desireCapacity <= GetReadableBytes()) { + if (data_ == nullptr) { + UTILS_LOGE("data_ is nullptr when parcel is being read."); + return false; + } const void *data = data_ + readCursor_; #ifdef PARCEL_OBJECT_CHECK size_t upperBound = readCursor_ + desireCapacity;