aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-devtools/codexl/codexl/0008-Examples-AMDTTeaPot-fix-a-null-pointer-exception.patch
blob: 0c95e4f602bc51c0ca83795f47491f401ee9cfcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 50d21ce53601e97320ad1410f8e4f7275e9b4f5b Mon Sep 17 00:00:00 2001
From: Adeel Arshad <adeel_arshad@mentor.com>
Date: Mon, 17 Oct 2016 17:39:12 +0500
Subject: [PATCH] Examples/AMDTTeaPot: fix a null pointer exception

Check that whether _pAMDTTeapotOGLCanvas is initialized or
not before calling it method onSize, otherwise it will generate
NULL pointer exception or segmentation fault.

Signed-off-by: Adeel Arshad <adeel_arshad@mentor.com>
---
 CodeXL/Examples/AMDTTeaPot/AMDTTeaPot/src/GLWindow.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/CodeXL/Examples/AMDTTeaPot/AMDTTeaPot/src/GLWindow.cpp b/CodeXL/Examples/AMDTTeaPot/AMDTTeaPot/src/GLWindow.cpp
index d2755a2..4c7f6fa 100755
--- a/CodeXL/Examples/AMDTTeaPot/AMDTTeaPot/src/GLWindow.cpp
+++ b/CodeXL/Examples/AMDTTeaPot/AMDTTeaPot/src/GLWindow.cpp
@@ -127,7 +127,10 @@ void GLWindow::draw()
 //
 void GLWindow::resize(int X, int Y, int W, int H)
 {
-    _pAMDTTeapotOGLCanvas->onSize(W, H);
+    if (NULL != _pAMDTTeapotOGLCanvas)
+    {
+        _pAMDTTeapotOGLCanvas->onSize(W, H);
+    }
     swap_buffers();
     Fl_Gl_Window::resize(X, Y, W, H);
 }
-- 
1.9.1