Skip to content
Snippets Groups Projects
Commit 42b5e68c authored by Edric Milaret's avatar Edric Milaret Committed by Guillaume Roguez
Browse files

windows: fix SIGSEGV occuring when no camera are found

Refs #71985

Change-Id: I78aa51ef823a2d48da96d4f0ed58bc838915b4f5
parent 85a890d0
No related branches found
No related tags found
No related merge requests found
......@@ -105,17 +105,17 @@ VideoDeviceMonitorImpl::run()
hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pDevEnum));
IEnumMoniker *pEnum;
IEnumMoniker *pEnum = nullptr;
if (SUCCEEDED(hr)) {
hr = pDevEnum->CreateClassEnumerator(
CLSID_VideoInputDeviceCategory,
&pEnum, 0);
if (FAILED(hr)) {
pDevEnum->Release();
if (FAILED(hr) || pEnum == nullptr) {
RING_ERR("No webcam found.");
hr = VFW_E_NOT_FOUND;
}
pDevEnum->Release();
if (hr != VFW_E_NOT_FOUND) {
if (hr != VFW_E_NOT_FOUND && pEnum != nullptr) {
IMoniker *pMoniker = NULL;
unsigned deviceID = 0;
while (pEnum->Next(1, &pMoniker, NULL) == S_OK)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment