diff --git a/libfreerdp/gdi/graphics.c b/libfreerdp/gdi/graphics.c index b1c1b1b47..0424a8ae3 100644 --- a/libfreerdp/gdi/graphics.c +++ b/libfreerdp/gdi/graphics.c @@ -183,7 +183,14 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, static BOOL gdi_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary) { - rdpGdi* gdi = context->gdi; + rdpGdi* gdi; + + if (!context) + return FALSE; + + gdi = context->gdi; + if (!gdi) + return FALSE; if (primary) gdi->drawing = gdi->primary;