Skip to content

Commit b84f46c

Browse files
author
zhourenjian
committed
Fix a NPE bug
Fix bug that *.custom.* widgets may override Widget#checkStyle with different argument types. Only default #checkStyle method will be called ahead.
1 parent 6b153f0 commit b84f46c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/graphics/FontData.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ public boolean equals (Object object) {
305305
// data.lfClipPrecision == lf.lfClipPrecision &&
306306
// data.lfQuality == lf.lfQuality &&
307307
// data.lfPitchAndFamily == lf.lfPitchAndFamily &&
308-
getName().equals(fd.getName());
308+
(getName() == null && fd.getName() == null)
309+
|| (getName ()!= null && getName().equals(fd.getName()));
309310
}
310311

311312
/*

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Widget.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ public Widget (Widget parent, int style) {
146146
this.style = style;
147147
/**
148148
* @j2sNative
149-
* if (!this.styleChecked && this.checkStyle != null) {
149+
* if (!this.styleChecked && this.checkStyle != null
150+
* && this.checkStyle.funParams == "\Number") {
150151
* this.style = this.checkStyle (this.style);
151152
* this.styleChecked = true;
152153
* }

0 commit comments

Comments
 (0)