diff --git a/reactos/lib/setupapi/devinst.c b/reactos/lib/setupapi/devinst.c index 86e2dade38e..85ef9151e93 100644 --- a/reactos/lib/setupapi/devinst.c +++ b/reactos/lib/setupapi/devinst.c @@ -3493,7 +3493,7 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdA( DeviceInstanceIdW, DeviceInstanceIdSize, RequiredSize); - if (DeviceInstanceIdW != NULL) + if (ret && DeviceInstanceIdW != NULL) { if (WideCharToMultiByte(CP_ACP, 0, DeviceInstanceIdW, -1, DeviceInstanceId, DeviceInstanceIdSize, NULL, NULL) == 0)