[ostree] upgrade: Don't segfault if there's no previous deployment



commit 0f65d7358172eb33254a1bcc4cec6ba7ae3f57bd
Author: Colin Walters <walters verbum org>
Date:   Fri Sep 20 09:42:50 2013 -0400

    upgrade: Don't segfault if there's no previous deployment
    
    Obviously.

 src/ostree/ot-admin-builtin-upgrade.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index 045d132..27925c5 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -72,6 +72,12 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeSysroot *sysroot, GCancel
   if (!opt_osname)
     opt_osname = (char*)ostree_deployment_get_osname (ostree_sysroot_get_booted_deployment (sysroot));
   merge_deployment = ostree_sysroot_get_merge_deployment (sysroot, opt_osname); 
+  if (merge_deployment == NULL)
+    {
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+                   "No previous deployment for OS '%s'", opt_osname);
+      goto out;
+    }
 
   deployment_path = ostree_sysroot_get_deployment_directory (sysroot, merge_deployment);
   deployment_origin_path = ostree_sysroot_get_deployment_origin_path (deployment_path);


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