mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-27 19:54:38 +00:00
33 lines
938 B
Diff
33 lines
938 B
Diff
diff --git a/IOKitLib.c b/IOKitLib.c
|
|
index 81ed8f7..3120abb 100644
|
|
--- a/IOKitLib.c
|
|
+++ b/IOKitLib.c
|
|
@@ -884,6 +884,15 @@ IONotificationPortGetRunLoopSource(
|
|
CFMachPortContext context;
|
|
Boolean cfReusedPort = false;
|
|
|
|
+#ifdef DARLING
|
|
+ /* A notification port can still be absent when allocation fails or
|
|
+ * the IOKit service is unavailable. Keep the accessor tolerant of
|
|
+ * that failure; CFRunLoopAddSource already ignores NULL sources.
|
|
+ * Normal power registration is implemented by iokitd. */
|
|
+ if (!notify)
|
|
+ return NULL;
|
|
+#endif
|
|
+
|
|
if (notify->source)
|
|
return (notify->source);
|
|
|
|
@@ -934,6 +943,11 @@ mach_port_t
|
|
IONotificationPortGetMachPort(
|
|
IONotificationPortRef notify )
|
|
{
|
|
+#ifdef DARLING
|
|
+ /* See IONotificationPortGetRunLoopSource: fail soft on NULL. */
|
|
+ if (!notify)
|
|
+ return MACH_PORT_NULL;
|
|
+#endif
|
|
return( notify->wakePort );
|
|
}
|
|
|