Skip to content

Commit c7b5b70

Browse files
authored
Fixed NullPointerException issue
1 parent 4871af6 commit c7b5b70

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tinystruct/examples/talk.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,13 @@ public final String update(final String sessionId) throws ApplicationException,
130130
Queue<Builder> messages = this.list.get(sessionId);
131131
// If there is a new message, then return it directly
132132
if((message = messages.poll()) != null) return message.toString();
133-
133+
134134
long startTime = System.currentTimeMillis();
135135
while((message = messages.poll()) == null && (System.currentTimeMillis()-startTime) <= 10000) {
136136
;
137137
}
138-
return message.toString();
138+
139+
return message == null ? "{}" : message.toString();
139140
}
140141

141142
/**

0 commit comments

Comments
 (0)