[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : gerry
Repository : xara
Revision   : 772
Date       : Wed Apr  5 14:50:54 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/camview.cpp

Fixed GetClientSize to not crash if RenderWindow is NULL


Diff:
Index: Trunk/XaraLX/wxOil/camview.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camview.cpp	(revision 771)
+++ Trunk/XaraLX/wxOil/camview.cpp	(revision 772)
@@ -589,17 +589,24 @@
 
 void CCamView::GetClientSize(int * pWidth, int * pHeight) const /* TYPENOTE: Correct */
 {
-	WinRect wrect(0,0,0,0);
-	GetRenderWindow()->GetClientSize(&wrect.width, &wrect.height);
-	if (wrect.width<0) wrect.width = 0;
-	if (wrect.height<0) wrect.height = 0;
-	OilRect orect = wrect.ToOil(pDocView);
-	*pWidth  = orect.Width();
-	*pHeight = orect.Height();
+	if (GetRenderWindow())
+	{
+		WinRect wrect(0,0,0,0);
+		GetRenderWindow()->GetClientSize(&wrect.width, &wrect.height);
+		if (wrect.width<0) wrect.width = 0;
+		if (wrect.height<0) wrect.height = 0;
+		OilRect orect = wrect.ToOil(pDocView);
+		*pWidth  = orect.Width();
+		*pHeight = orect.Height();
+	}
+	else
+	{
+		*pWidth = 0;
+		*pHeight = 0;
+	}
 }
 
 
-
 // set this to 1 to show update rectangles using cross-hatching, 0 to not
 #define	SHOW_RECT 0
 


Xara