Commit 71e79a50 authored by Nikolay Igotti's avatar Nikolay Igotti

Fix crash on iMac.

parent b2c512dc
...@@ -117,10 +117,10 @@ BOOL isUsingIntegratedGPU() { ...@@ -117,10 +117,10 @@ BOOL isUsingIntegratedGPU() {
io_connect_t switcherConnect; io_connect_t switcherConnect;
kernResult = IOServiceOpen(service, mach_task_self(), 0, &switcherConnect); kernResult = IOServiceOpen(service, mach_task_self(), 0, &switcherConnect);
assert(kernResult == KERN_SUCCESS); if (kernResult != KERN_SUCCESS) return 0;
kernResult = IOConnectCallScalarMethod(switcherConnect, kOpen, NULL, 0, NULL, NULL); kernResult = IOConnectCallScalarMethod(switcherConnect, kOpen, NULL, 0, NULL, NULL);
assert(kernResult == KERN_SUCCESS); if (kernResult != KERN_SUCCESS) return 0;
uint64_t output; uint64_t output;
uint32_t outputCount = 1; uint32_t outputCount = 1;
...@@ -132,6 +132,7 @@ BOOL isUsingIntegratedGPU() { ...@@ -132,6 +132,7 @@ BOOL isUsingIntegratedGPU() {
2, 2,
&output, &output,
&outputCount); &outputCount);
if (kernResult != KERN_SUCCESS) return 0;
return output != 0; return output != 0;
} }
...@@ -241,4 +242,4 @@ JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_disposeDe ...@@ -241,4 +242,4 @@ JNIEXPORT void JNICALL Java_org_jetbrains_skiko_redrawer_MetalRedrawer_disposeDe
} }
} // extern C } // extern C
#endif #endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment