Fix potential null exceptions

This commit is contained in:
agnostic-apollo
2021-03-10 02:33:45 +05:00
parent 324a69f7fa
commit dbf84773d4
2 changed files with 20 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ public abstract class TerminalOutput {
/** Write a string using the UTF-8 encoding to the terminal client. */
public final void write(String data) {
if (data == null) return;
byte[] bytes = data.getBytes(StandardCharsets.UTF_8);
write(bytes, 0, bytes.length);
}