Add a few more NULL pointer checks.
[platform/upstream/libexif.git] / libexif / exif-loader.c
index 825df16..1171485 100644 (file)
@@ -14,8 +14,8 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301  USA.
  */
 
 #include <config.h>
@@ -110,7 +110,7 @@ exif_loader_write_file (ExifLoader *l, const char *path)
        int size;
        unsigned char data[1024];
 
-       if (!l
+       if (!l || !path)
                return;
 
        f = fopen (path, "rb");
@@ -410,13 +410,16 @@ exif_loader_get_buf (ExifLoader *loader, const unsigned char **buf,
        const unsigned char* b = NULL;
        unsigned int s = 0;
 
-       if (!loader || (loader->data_format == EL_DATA_FORMAT_UNKNOWN)) {
-               exif_log (loader->log, EXIF_LOG_CODE_DEBUG, "ExifLoader",
-                         "Loader format unknown");
-       } else {
-               b = loader->buf;
-               s = loader->bytes_read;
+       if (loader) {
+               if (loader->data_format == EL_DATA_FORMAT_UNKNOWN) {
+                       exif_log (loader->log, EXIF_LOG_CODE_DEBUG, "ExifLoader",
+                                         "Loader format unknown");
+               } else {
+                       b = loader->buf;
+                       s = loader->bytes_read;
+               }
        }
+
        if (buf)
                *buf = b;
        if (buf_size)