[gitg] Only call diff_similar if diff not null



commit 989218fe1aba85682760cafef513eb594e3e17d0
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Mon Jun 30 22:01:58 2014 +0200

    Only call diff_similar if diff not null

 libgitg/gitg-commit.vala |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/libgitg/gitg-commit.vala b/libgitg/gitg-commit.vala
index cab123d..2aba60d 100644
--- a/libgitg/gitg-commit.vala
+++ b/libgitg/gitg-commit.vala
@@ -154,12 +154,18 @@ public class Commit : Ggit.Commit
                                }
                        }
                }
-               catch {}
+               catch (Error e)
+               {
+                       stderr.printf("Error when getting diff: %s\n", e.message);
+               }
 
-               try
+               if (diff != null)
                {
-                       diff.find_similar(null);
-               } catch {}
+                       try
+                       {
+                               diff.find_similar(null);
+                       } catch {}
+               }
 
                return diff;
        }


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