[virt-tools-list] [PATCH virt-viewer 1/6] file: make constructor accept NULL location

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Fri Jun 23 15:30:53 UTC 2017


From: Marc-André Lureau <marcandre.lureau at redhat.com>

We are going to make empty/fake VirtViewerFile.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/virt-viewer-file.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
index 9ff2a05..dfc6164 100644
--- a/src/virt-viewer-file.c
+++ b/src/virt-viewer-file.c
@@ -141,11 +141,13 @@ enum  {
 VirtViewerFile*
 virt_viewer_file_new(const gchar* location, GError** error)
 {
-    GError* inner_error = NULL;
+    VirtViewerFile* self = VIRT_VIEWER_FILE(g_object_new(VIRT_VIEWER_TYPE_FILE, NULL));
 
-    g_return_val_if_fail (location != NULL, NULL);
+    if (!location) {
+        return self;
+    }
 
-    VirtViewerFile* self = VIRT_VIEWER_FILE(g_object_new(VIRT_VIEWER_TYPE_FILE, NULL));
+    GError* inner_error = NULL;
     GKeyFile* keyfile = self->priv->keyfile;
 
     g_key_file_load_from_file(keyfile, location,
-- 
2.13.1.395.gf7b71de06




More information about the virt-tools-list mailing list