Revision: 48489
          http://brlcad.svn.sourceforge.net/brlcad/?rev=48489&view=rev
Author:   starseeker
Date:     2012-01-12 14:21:15 +0000 (Thu, 12 Jan 2012)
Log Message:
-----------
Do the NULL check. CID 397

Modified Paths:
--------------
    brlcad/trunk/src/fb/gif2fb.c

Modified: brlcad/trunk/src/fb/gif2fb.c
===================================================================
--- brlcad/trunk/src/fb/gif2fb.c        2012-01-12 14:14:18 UTC (rev 48488)
+++ brlcad/trunk/src/fb/gif2fb.c        2012-01-12 14:21:15 UTC (rev 48489)
@@ -264,33 +264,32 @@
 /*
  * Open the frame buffer.
  */
-    fbp = fb_open(framebuffer, WORD(Im.IH_Width),
-                 WORD(Im.IH_Height));
-
-/*
- * The speed of this loop can be greatly increased by moving all of
- * the WORD macro calls out of the loop.
- */
-    for (i=0; i<WORD(Im.IH_Height);i++) {
+    if ((fbp = fb_open(framebuffer, WORD(Im.IH_Width), WORD(Im.IH_Height))) != 
NULL) {
+      /*
+       * The speed of this loop can be greatly increased by moving all of
+       * the WORD macro calls out of the loop.
+       */
+      for (i=0; i<WORD(Im.IH_Height);i++) {
        int k;
        lp = line;
        for (k=0;k<WORD(Im.IH_Width);k++) {
-           idx = getByte(fp);
-           *lp++ = GlobalColors[idx].red;
-           *lp++ = GlobalColors[idx].green;
-           *lp++ = GlobalColors[idx].blue;
+         idx = getByte(fp);
+         *lp++ = GlobalColors[idx].red;
+         *lp++ = GlobalColors[idx].green;
+         *lp++ = GlobalColors[idx].blue;
        }
        fb_write(fbp, 0, WORD(Im.IH_Height)-lineNumber, line,
-                WORD(Im.IH_Width));
+           WORD(Im.IH_Width));
        fb_flush(fbp);
        lineNumber += lineInc;
        if (lineNumber >= WORD(Im.IH_Height)) {
-           ++lineIdx;
-           lineInc = lace[lineIdx];
-           lineNumber = offs[lineIdx];
+         ++lineIdx;
+         lineInc = lace[lineIdx];
+         lineNumber = offs[lineIdx];
        }
+      }
+      fb_close(fbp);
     }
-    fb_close(fbp);
     return 0;
 }
 /* getcode - Get a LWZ "code"

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to