# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1603664444 0 # Node ID f0611d5385f9f6bef471519f4085c2003ec4659d # Parent 8c6f087e71829a2e35948435a86c7297ff5f4d41 Mac: Fix CGContext 0x0 warnings by checking the CGContext is valid first. diff -r 8c6f087e7182 -r f0611d5385f9 mac/dw.m --- 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];