[hyena] Protect against StyleGetProperty exceptions



commit c9c56007e5d5c812d19b1448f80845d691209186
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Fri Jul 9 16:17:29 2010 -0700

    Protect against StyleGetProperty exceptions
    
    This happens when the property is not set in the gtkrc,
    which seems to be a fairly common case.

 Hyena.Gui/Hyena.Gui/GtkUtilities.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Gui/GtkUtilities.cs b/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
index 7b31440..2e45b22 100644
--- a/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
+++ b/Hyena.Gui/Hyena.Gui/GtkUtilities.cs
@@ -142,7 +142,10 @@ namespace Hyena.Gui
 
         public static T StyleGetProperty<T> (Widget widget, string property, T default_value)
         {
-            object result = widget.StyleGetProperty (property);
+            object result = null;
+            try {
+                result = widget.StyleGetProperty (property);
+            } catch {}
             return result != null && result.GetType () == typeof (T) ? (T)result : default_value;
         }
 



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