[Patch] Fix

Nicolas Centa <[email protected]> Thu, 23 Oct 2003 18:16:42 +0200
Newsgroups gmane.editors.mlview.devel
Message-ID <[email protected]>
Hello,

Mlview used to crash when you specified a non existing file on the command line.
This patch fixes that by a MLVIEW_BAD_FILE_ERROR.

Nicolas Centa
"HappyPeng"
fix.diff (application/octet-stream, 570 B)
diff -ru orig/mlview/src/mlview-parsing-utils.c mlview/src/mlview-parsing-utils.c
--- orig/mlview/src/mlview-parsing-utils.c	2003-10-23 18:11:08.000000000 +0200
+++ mlview/src/mlview-parsing-utils.c	2003-10-23 18:11:25.000000000 +0200
@@ -291,6 +291,10 @@
                               MLVIEW_NULL_FILE_NAME_ERROR);
 
         file_ptr = fopen (a_xml_file_name, "rb");
+
+        g_return_val_if_fail (file_ptr != NULL,
+                              MLVIEW_BAD_FILE_ERROR);
+
         c1 = fgetc (file_ptr);
         c2 = fgetc (file_ptr);
         fclose (file_ptr);