win-capture: Fix crash if no display is available
If no displays are available, numPath or numMode can be 0, which will result in a bmalloc(0) call and OBS will crash.
This commit is contained in:
parent
720f37046f
commit
c86de0587a
@ -130,6 +130,9 @@ static bool GetMonitorTarget(LPCWSTR device, DISPLAYCONFIG_TARGET_DEVICE_NAME *t
|
||||
|
||||
UINT32 numPath, numMode;
|
||||
if (GetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &numPath, &numMode) == ERROR_SUCCESS) {
|
||||
if (!numPath || !numMode) {
|
||||
return false;
|
||||
}
|
||||
DISPLAYCONFIG_PATH_INFO *paths = bmalloc(numPath * sizeof(DISPLAYCONFIG_PATH_INFO));
|
||||
DISPLAYCONFIG_MODE_INFO *modes = bmalloc(numMode * sizeof(DISPLAYCONFIG_MODE_INFO));
|
||||
if (QueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &numPath, paths, &numMode, modes, NULL) ==
|
||||
|
Loading…
x
Reference in New Issue
Block a user