Make some changes to prevent crash
This commit is contained in:
parent
bfa54b4804
commit
ee60a52249
1 changed files with 11 additions and 7 deletions
|
@ -98,6 +98,7 @@ class PacketClient {
|
|||
CompoundTag ct = CompoundTag();
|
||||
Completer<void> onCompletion = Completer();
|
||||
socket!.listen((data) async {
|
||||
try {
|
||||
CompoundTag result = await NbtIo.readFromStream(data);
|
||||
|
||||
StringBuilder builder = StringBuilder();
|
||||
|
@ -105,8 +106,11 @@ class PacketClient {
|
|||
|
||||
print("Response from server: \n${builder}");
|
||||
ct.put("result", result);
|
||||
|
||||
} catch (E, S) {
|
||||
print(S);
|
||||
} finally {
|
||||
onCompletion.complete();
|
||||
}
|
||||
}, onError: (E, stack) {
|
||||
print("ERROR: ${E}\n${stack}");
|
||||
if (!onCompletion.isCompleted) onCompletion.complete();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue