From 8b45904fa7361fc3a0cbd0a2da7c994ca6fdf660 Mon Sep 17 00:00:00 2001 From: amaitland Date: Tue, 18 Nov 2014 13:03:53 +1000 Subject: [PATCH] Event handling best practice Also make consistent --- CefSharp.Offscreen/ChromiumWebBrowser.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CefSharp.Offscreen/ChromiumWebBrowser.cs b/CefSharp.Offscreen/ChromiumWebBrowser.cs index 2db984ef7..4d36c086f 100644 --- a/CefSharp.Offscreen/ChromiumWebBrowser.cs +++ b/CefSharp.Offscreen/ChromiumWebBrowser.cs @@ -355,8 +355,11 @@ namespace CefSharp.Offscreen bitmap = BitmapSourceToBitmap2(Imaging.CreateBitmapSourceFromMemorySection(bitmapInfo.FileMappingHandle, bitmapInfo.Width, bitmapInfo.Height, PixelFormats.Bgra32, stride, 0)); - if (NewScreenshot != null) - NewScreenshot(this, EventArgs.Empty); + var handler = NewScreenshot; + if (handler != null) + { + handler(this, EventArgs.Empty); + } } } }