You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/10/12 17:03:32 UTC
svn commit: r824370 -
/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java
Author: tvolkert
Date: Mon Oct 12 15:03:32 2009
New Revision: 824370
URL: http://svn.apache.org/viewvc?rev=824370&view=rev
Log:
Fixed null pointer exception in Mouse.setCursor() (when component was not attached to the display)
Modified:
incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java
Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java?rev=824370&r1=824369&r2=824370&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java Mon Oct 12 15:03:32 2009
@@ -289,15 +289,21 @@
if (component.isEnabled()) {
cursor = component.getCursor();
while (cursor == null
+ && component != null
&& !(component instanceof Display)) {
component = component.getParent();
- cursor = component.getCursor();
+ if (component != null) {
+ cursor = component.getCursor();
+ }
}
}
- Display display = component.getDisplay();
- ApplicationContext.DisplayHost displayHost = display.getDisplayHost();
- displayHost.setCursor((cursor == null) ? java.awt.Cursor.getDefaultCursor() : getCursor(cursor));
+ if (component != null) {
+ Display display = component.getDisplay();
+ ApplicationContext.DisplayHost displayHost = display.getDisplayHost();
+ displayHost.setCursor((cursor == null) ? java.awt.Cursor.getDefaultCursor() :
+ getCursor(cursor));
+ }
}
private static java.awt.Cursor getCursor(Cursor cursor) {