[gnome-boxes/troubleshoot-view: 6/7] app: Express post-condition while setting default source



commit 610c32fc98fe300cc02a5f28f8e9aa86eef31464
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Aug 29 13:13:16 2017 +0200

    app: Express post-condition while setting default source
    
    Using "ensures" doesn't crash hard when an invariant is violated.

 src/app.vala | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index df84cd4e..4dba2aaf 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -399,7 +399,7 @@ private async void activate_async () {
         setup_sources.begin ();
     }
 
-    private async void setup_default_source () {
+    private async void setup_default_source () ensures (default_connection != null) {
         var path = get_user_pkgconfig_source (DEFAULT_SOURCE_NAME);
         var create_session_source = true;
         try {
@@ -430,8 +430,6 @@ private async void setup_default_source () {
             printerr ("Error setting up default broker: %s\n", error.message);
             release (); // will end application
         }
-
-        assert (default_connection != null);
     }
 
     private new void send_notification (string notification_id, GLib.Notification notification) {


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