Skip to content

Commit ba8a88a

Browse files
author
Lasse Luttermann
committed
Do not try to compare a string that may be a null-pointer
1 parent cb2d54a commit ba8a88a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/modules/upower.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,8 @@ void UPower::setDisplayDevice() {
370370
auto thisPtr{static_cast<UPower *>(user_data)};
371371
upDevice.upDevice = static_cast<UpDevice *>(data);
372372
thisPtr->getUpDeviceInfo(upDevice);
373+
if (upDevice.nativePath == nullptr)
374+
return;
373375
if (0 == std::strcmp(upDevice.nativePath, thisPtr->nativePath_.c_str())) {
374376
// Unref current upDevice
375377
if (thisPtr->upDevice_.upDevice != NULL) g_object_unref(thisPtr->upDevice_.upDevice);

0 commit comments

Comments
 (0)