This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
Fix one, break one
- From: Jim Kingdon <kingdon at panix dot com>
- To: xconq7 at sources dot redhat dot com
- Date: Sun, 25 May 2003 11:22:54 -0400 (EDT)
- Subject: Fix one, break one
- References: <l03130300baf630e2dd6c@[212.181.162.155]>
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)) {