Files
darling-lol/patches/IOKitUser.patch
T

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 );
}