From 81aaea9a29f7c9fe0ce04583d45dd47645559673 Mon Sep 17 00:00:00 2001 From: BackToTheDrawingBoard Date: Thu, 2 Feb 2017 09:30:40 -0600 Subject: [PATCH] Fixing Null Pointer Exception in ShowWindow If the ViewWin isn't added to g_active_views before ShowWindow is called, then it can't be found by the handle, and consequently there is a null pointer exception. Please fix this. I spent 45 minutes debugging the tutorial when I could have been learning Awesomium. --- src/view_win.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/view_win.cc b/src/view_win.cc index 10505af..18e6743 100644 --- a/src/view_win.cc +++ b/src/view_win.cc @@ -45,12 +45,12 @@ class ViewWin : public View, web_view_->set_parent_window(hwnd_); + g_active_views_.push_back(this); + ShowWindow(hwnd_, SW_SHOWNORMAL); UpdateWindow(hwnd_); SetTimer (hwnd_, 0, 15, NULL ); - - g_active_views_.push_back(this); } virtual ~ViewWin() { @@ -170,4 +170,4 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) View* View::Create(int width, int height) { return new ViewWin(width, height); -} \ No newline at end of file +}