Skip to content

Commit 164d6f5

Browse files
committed
SwtDebug.dumpEvent is now null-safe.
1 parent ace244c commit 164d6f5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Added `ControlWrapper.setParent` which is a pure delegation to `Control.setParent`.
1111
- Improved `StructuredDrop.handler`.
1212
- Added `SwtMisc.globalBounds` for `ControlWrapper`.
13+
- `SwtDebug.dumpEvent` is now null-safe.
1314

1415
### Version 3.2.1 - August 7th 2019 ([javadoc](http://diffplug.github.io/durian-swt/javadoc/3.2.1/), [jcenter](https://bintray.com/diffplug/opensource/durian-swt/3.2.1/view))
1516

durian-swt/src/main/java/com/diffplug/common/swt/SwtDebug.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@
4343
*/
4444
public class SwtDebug {
4545
/** Dumps the given SWT event to System.out. */
46-
public static void dumpEvent(String name, Event e) {
46+
public static void dumpEvent(String name, @Nullable Event e) {
4747
dumpEvent(name, e, StringPrinter.systemOut());
4848
}
4949

5050
/** Dumps the given SWT event to the given StringPrinter. */
51-
public static void dumpEvent(String name, Event e, StringPrinter to) {
51+
public static void dumpEvent(String name, @Nullable Event e, StringPrinter to) {
52+
if (e == null) {
53+
to.println(name + ": null");
54+
return;
55+
}
5256
// print the name
5357
to.println(name + ": " + eventType(e));
5458
// print the non-null / non-zero fields

0 commit comments

Comments
 (0)