Do not try to compare a string that may be a null-pointer
parent
cb2d54a237
commit
ba8a88acfb
|
@ -370,6 +370,8 @@ void UPower::setDisplayDevice() {
|
||||||
auto thisPtr{static_cast<UPower *>(user_data)};
|
auto thisPtr{static_cast<UPower *>(user_data)};
|
||||||
upDevice.upDevice = static_cast<UpDevice *>(data);
|
upDevice.upDevice = static_cast<UpDevice *>(data);
|
||||||
thisPtr->getUpDeviceInfo(upDevice);
|
thisPtr->getUpDeviceInfo(upDevice);
|
||||||
|
if (upDevice.nativePath == nullptr)
|
||||||
|
return;
|
||||||
if (0 == std::strcmp(upDevice.nativePath, thisPtr->nativePath_.c_str())) {
|
if (0 == std::strcmp(upDevice.nativePath, thisPtr->nativePath_.c_str())) {
|
||||||
// Unref current upDevice
|
// Unref current upDevice
|
||||||
if (thisPtr->upDevice_.upDevice != NULL) g_object_unref(thisPtr->upDevice_.upDevice);
|
if (thisPtr->upDevice_.upDevice != NULL) g_object_unref(thisPtr->upDevice_.upDevice);
|
||||||
|
|
Loading…
Reference in New Issue