Merge "fix warning: dereference of a null pointer"
am: 9a6b9ed394
Change-Id: I8f944dd30a2663262baa00a08c1e4204a29242eb
diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp
index e3d2ec6..52ea363 100644
--- a/media/mtp/MtpDevice.cpp
+++ b/media/mtp/MtpDevice.cpp
@@ -266,19 +266,20 @@
}
void MtpDevice::print() {
- if (mDeviceInfo) {
- mDeviceInfo->print();
+ if (!mDeviceInfo)
+ return;
- if (mDeviceInfo->mDeviceProperties) {
- ALOGI("***** DEVICE PROPERTIES *****\n");
- int count = mDeviceInfo->mDeviceProperties->size();
- for (int i = 0; i < count; i++) {
- MtpDeviceProperty propCode = (*mDeviceInfo->mDeviceProperties)[i];
- MtpProperty* property = getDevicePropDesc(propCode);
- if (property) {
- property->print();
- delete property;
- }
+ mDeviceInfo->print();
+
+ if (mDeviceInfo->mDeviceProperties) {
+ ALOGI("***** DEVICE PROPERTIES *****\n");
+ int count = mDeviceInfo->mDeviceProperties->size();
+ for (int i = 0; i < count; i++) {
+ MtpDeviceProperty propCode = (*mDeviceInfo->mDeviceProperties)[i];
+ MtpProperty* property = getDevicePropDesc(propCode);
+ if (property) {
+ property->print();
+ delete property;
}
}
}