changeset 32:a6388599b106

do not blindly cast to Component ... the source of the event may be some arbitrary object (e.g. a model)
author dirk
date Tue, 20 Sep 2011 17:21:03 +0200
parents 56cf93ee85f4
children cc648f83cdbc
files conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ExceptionHandlingListSelectionListener.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ExceptionHandlingListSelectionListener.java	Tue Sep 20 17:00:45 2011 +0200
+++ b/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ExceptionHandlingListSelectionListener.java	Tue Sep 20 17:21:03 2011 +0200
@@ -27,7 +27,12 @@
         catch (Exception ex)
         {
             String stacktrace = ExceptionUtil.toString(ex);
-            Component source = (Component)event.getSource();
+
+            Component source = null;
+            if (event.getSource() instanceof Component)
+            {
+                source = (Component)event.getSource();
+            }
             JOptionPane.showMessageDialog(source, stacktrace, "Error", JOptionPane.ERROR_MESSAGE);
         }
     }