[incremental service] avoid nullptr dereferencing
externalListener could be nullptr.
BUG: 150795871
Test: atest service.incremental_test
Change-Id: I2843e1751cb1f7e9318edb05e9a8f5256ad9f3a8
diff --git a/services/incremental/IncrementalService.cpp b/services/incremental/IncrementalService.cpp
index cccd0133..44a2010 100644
--- a/services/incremental/IncrementalService.cpp
+++ b/services/incremental/IncrementalService.cpp
@@ -1090,7 +1090,9 @@
base::unique_fd(::dup(ifs.control.pendingReads)));
fsControlParcel.incremental->log.reset(base::unique_fd(::dup(ifs.control.logs)));
sp<IncrementalDataLoaderListener> listener =
- new IncrementalDataLoaderListener(*this, *externalListener);
+ new IncrementalDataLoaderListener(*this,
+ externalListener ? *externalListener
+ : DataLoaderStatusListener());
bool created = false;
auto status = mDataLoaderManager->initializeDataLoader(ifs.mountId, *dlp, fsControlParcel,
listener, &created);
@@ -1230,8 +1232,8 @@
std::unique_lock l(incrementalService.mLock);
const auto& ifs = incrementalService.getIfsLocked(mountId);
if (!ifs) {
- LOG(WARNING) << "Received data loader status " << int(newStatus) << " for unknown mount "
- << mountId;
+ LOG(WARNING) << "Received data loader status " << int(newStatus)
+ << " for unknown mount " << mountId;
return binder::Status::ok();
}
ifs->dataLoaderStatus = newStatus;