Fix ServerBridge trace NPE
authorNiki Roo <niki@nikiroo.be>
Fri, 22 Jun 2018 05:18:07 +0000 (05:18 +0000)
committerNiki Roo <niki@nikiroo.be>
Fri, 22 Jun 2018 05:18:07 +0000 (05:18 +0000)
src/be/nikiroo/utils/serial/server/ServerBridge.java

index 157b27ee9cc0df8c620a6163e5d0ae524d4b4e57..ea9fd1b3d3514439d813299b9a77128d6e4f6f9d 100644 (file)
@@ -220,7 +220,7 @@ public class ServerBridge extends Server {
         *            the data to trace
         */
        private void trace(String prefix, String data) {
-               int size = data.length();
+               int size = data == null ? 0 : data.length();
                String ssize = size + " byte";
                if (size > 1) {
                        ssize = size + " bytes";