git » fp-git.git » commit 12093f6

bugfixed (bmp not loaded error)

author ecalot
2005-07-09 20:11:20 UTC
committer ecalot
2005-07-09 20:11:20 UTC
parent 12e0964c4c0711b59661c76c6b9f253f43b6e5a8

bugfixed (bmp not loaded error)

poprecog/poprecog.c +2 -0

diff --git a/poprecog/poprecog.c b/poprecog/poprecog.c
index 8748c47..49a3fd6 100644
--- a/poprecog/poprecog.c
+++ b/poprecog/poprecog.c
@@ -442,6 +442,7 @@ void recognizeScreenShot(int screenShotID) {
 	fprintf(outputSmallFile, POPRECOG_RECOGNIZING2, screenShotList[screenShotID]);  
 	sprintf(buf, "%s" SEPS "%s", screenShotsDir, screenShotList[screenShotID]);
 	screenShot = load_bmp(buf, 0);
+	if (!screenShot) return; /* bugfix: do exit in case of file not open */
 	transparentScreenShot = load_bmp(buf, 0);  
 	DEBUGScreenShot = create_bitmap(500, 400);
 	clear_to_color(DEBUGScreenShot, makecol(50, 50, 50));
@@ -696,6 +697,7 @@ void readDir(int dirID) {
 			image[imagesNumber].filePath = (char *) malloc(strlen(buf)+1);
 			strcpy(image[imagesNumber].filePath, buf);
 			image[imagesNumber].bitmap = load_bmp(image[imagesNumber].filePath, 0);
+			if (!image[imagesNumber].bitmap) continue; /* bugfix in case the image couldn't be loaded */
 			image[imagesNumber].direction = '-';      
 			image[imagesNumber].pixelsNumber = countPixels(image[imagesNumber].bitmap);
 			image[imagesNumber].dirID = dirID;