[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10889] trunk/blender/source/blender/src/ drawoops.c: Some more coverity fixes.

Kent Mein mein at cs.umn.edu
Thu Jun 7 04:00:15 CEST 2007


Revision: 10889
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10889
Author:   sirdude
Date:     2007-06-07 04:00:11 +0200 (Thu, 07 Jun 2007)

Log Message:
-----------
Some more coverity fixes.
This one moves some pointer checks up in the code 
(they were after the pointer was used, kind of useless at that point) ;)

Kent

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawoops.c

Modified: trunk/blender/source/blender/src/drawoops.c
===================================================================
--- trunk/blender/source/blender/src/drawoops.c	2007-06-06 19:12:07 UTC (rev 10888)
+++ trunk/blender/source/blender/src/drawoops.c	2007-06-07 02:00:11 UTC (rev 10889)
@@ -341,15 +341,15 @@
 	if(oops->id== (ID *)((G.scene->basact) ? (G.scene->basact->object) : 0)) line= 1;
 	else if(oops->id== (ID *)G.scene) line= 1;
 
+	if (!oops->id) return;
+
 	if(oops->id->us) {
 		cpack(body);
 
 		glRectf(x1, y1, x2, y2);
 	}
 
-	/* it has never happened that an oops was missing an ID at
-	this point but has occured elseware so lets be safe */
-	if(oops->id && oops->id->lib) { 
+	if(oops->id->lib) { 
 		if(oops->id->flag & LIB_INDIRECT) cpack(0x1144FF);
 		else cpack(0x11AAFF);
 
@@ -357,7 +357,7 @@
 	}
 
 	v1[0]= x1; 
-    v1[1] = y1;
+	v1[1] = y1;
 
 	if(oops->type==ID_LI) {
 		sprintf(str, " %s", ((Library *)oops->id)->name);
@@ -430,6 +430,8 @@
 	float col[3];
 	
 	BIF_GetThemeColor3fv(TH_BACK, col);
+
+	if(soops==0) return;	
 	
 	/* darker background for oops */
 	if(soops->type!=SO_OUTLINER) {
@@ -438,7 +440,6 @@
 	
 	glClearColor(col[0], col[1], col[2], 0.0);
 	glClear(GL_COLOR_BUFFER_BIT);
-	if(soops==0) return;	
 	
 	if(soops->type==SO_OUTLINER) draw_outliner(sa, soops);
 	else {





More information about the Bf-blender-cvs mailing list