[gedit-code-assistance/protect] Check for empty document directly in loop



commit bdade05eb3906d98a777377609405f29e0f4877a
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Mon Jan 13 16:35:09 2014 +0100

    Check for empty document  directly in loop

 src/gca-backend.vala |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/gca-backend.vala b/src/gca-backend.vala
index 00fd1eb..be30949 100644
--- a/src/gca-backend.vala
+++ b/src/gca-backend.vala
@@ -145,13 +145,6 @@ class Backend : Object
        {
                var doc = v.document;
 
-               if (doc == null)
-               {
-                       // This happens when a document has been closed while we're
-                       // iterating over open views.
-                       return null;
-               }
-
                if (doc.is_modified)
                {
                        try
@@ -181,6 +174,13 @@ class Backend : Object
 
                foreach (var v in views)
                {
+                       if (v.document == null)
+                       {
+                               // This happens when a document has been closed while we're
+                               // iterating over open views.
+                               continue;
+                       }
+
                        var dp = yield unsaved_document(v);
 
                        ret += DBus.OpenDocument(){


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