This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix one, break one


I've checked in the following change.  Not sure whether it is quite
right, as the reason for calling add_shrunken_image twice (or in fact,
what about add_shrunken_image is stateful) is not clear.

Oh, and Stan, a unit test would almost surely have caught this, or at
least made it more clear why the code is the way it is :-P.

2003-05-25  Jim Kingdon  <kingdon@panix.com>

	* kernel/imf.c (best_image): Check whether we got back NULL from
	the first call to add_shrunken_image before dereferencing.

Index: kernel/imf.c
===================================================================
RCS file: /cvs/xconq/xconq/kernel/imf.c,v
retrieving revision 1.39
diff -u -r1.39 imf.c
--- kernel/imf.c	25 May 2003 09:28:30 -0000	1.39
+++ kernel/imf.c	25 May 2003 15:18:33 -0000
@@ -1014,7 +1014,7 @@
        know it's not a tiling pattern), scale the image and return
	that. */
     if (best->w > w && best->h > h) {
     best = add_shrunken_image(imf);
-    if (best->w > w && best->h > h) {
+    if (best != NULL && best->w > w && best->h > h) {
           best = add_shrunken_image(imf);
	   }
     } else if (best->w <= (w >> 1) && best->h <= (h >> 1)) {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]