changeset 2196:f0611d5385f9

Mac: Fix CGContext 0x0 warnings by checking the CGContext is valid first.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 25 Oct 2020 22:20:44 +0000
parents 8c6f087e7182
children b818a32f7790
files mac/dw.m
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Sun Oct 25 21:42:41 2020 +0000
+++ b/mac/dw.m	Sun Oct 25 22:20:44 2020 +0000
@@ -991,8 +991,15 @@
     else
     {
         bgcolor = [[NSColor colorWithDeviceRed: DW_RED_VALUE(input)/255.0 green: DW_GREEN_VALUE(input)/255.0 blue: DW_BLUE_VALUE(input)/255.0 alpha: 1] retain];
-        [bgcolor set];
-        NSRectFill([self bounds]);
+#ifdef BUILDING_FOR_YOSEMITE
+        if([[NSGraphicsContext currentContext] CGContext])
+#else
+        if([[NSGraphicsContext currentContext] graphicsPort])
+#endif
+        {
+            [bgcolor set];
+            NSRectFill([self bounds]);
+        }
     }
     [self setNeedsDisplay:YES];
     [orig release];