[gcab] trivial: Return an error if we try to write an in-memory cfile



commit 16bd3e28fb26d56637155eb776749f5ec7f7b583
Author: Richard Hughes <richard hughsie com>
Date:   Tue Dec 12 21:35:27 2017 +0000

    trivial: Return an error if we try to write an in-memory cfile

 libgcab/gcab-cabinet.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/libgcab/gcab-cabinet.c b/libgcab/gcab-cabinet.c
index a1a64c4..f2405ae 100644
--- a/libgcab/gcab-cabinet.c
+++ b/libgcab/gcab-cabinet.c
@@ -282,7 +282,14 @@ gcab_cabinet_write (GCabCabinet *self,
         if (file_callback)
             file_callback (file, user_data);
 
-        in = G_INPUT_STREAM (g_file_read (gcab_file_get_gfile (file), cancellable, error));
+        GFile *gfile = gcab_file_get_gfile (file);
+        if (gfile == NULL) {
+            g_set_error (error, GCAB_ERROR, GCAB_ERROR_FORMAT,
+                         "No GFile for %s", gcab_file_get_name (file));
+            return FALSE;
+        }
+
+        in = G_INPUT_STREAM (g_file_read (gfile, cancellable, error));
         if (in == NULL)
             return FALSE;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]