Skip to content

Commit 6824e43

Browse files
committed
Nullcheck and reformat
1 parent d337e72 commit 6824e43

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/spyware/eventsources/WindowStatechangesEventSource.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ void startListening() {
5656
}
5757

5858
/**
59-
* Receives and logs sub window change events. Such as opening and closing a
60-
* new file and changing between open files.
59+
* Receives and logs sub window change events. Such as opening and closing a new file and
60+
* changing between open files.
6161
*/
6262
@Override
6363
public void propertyChange(PropertyChangeEvent evt) {
@@ -172,11 +172,13 @@ private String toStringWithObjects(Object object) {
172172
} else if (object instanceof Accessible) {
173173
try {
174174
Accessible acc = (Accessible) object;
175-
AccessibleContext context = acc.getAccessibleContext();
176-
if (context != null) {
177-
String str = context.getAccessibleName();
178-
if (str != null) {
179-
return str;
175+
if (acc != null) {
176+
AccessibleContext context = acc.getAccessibleContext();
177+
if (context != null) {
178+
String str = context.getAccessibleName();
179+
if (str != null) {
180+
return str;
181+
}
180182
}
181183
}
182184
} catch (Exception e) {
@@ -195,8 +197,7 @@ private String underscorify(String string) {
195197
}
196198

197199
/**
198-
* Returns {@link FileObject} representing the last active file for each
199-
* event.
200+
* Returns {@link FileObject} representing the last active file for each event.
200201
*/
201202
private FileObject getChangedFile() {
202203
JTextComponent jtc = EditorRegistry.lastFocusedComponent();

0 commit comments

Comments
 (0)