diff --git a/server/src/main/java/org/openqa/selenium/server/SeleniumDriverResourceHandler.java b/server/src/main/java/org/openqa/selenium/server/SeleniumDriverResourceHandler.java
index <HASH>..<HASH> 100644
--- a/server/src/main/java/org/openqa/selenium/server/SeleniumDriverResourceHandler.java
+++ b/server/src/main/java/org/openqa/selenium/server/SeleniumDriverResourceHandler.java
@@ -298,7 +298,9 @@ public class SeleniumDriverResourceHandler extends ResourceHandler {
         }

         results = doCommand(cmd, values, sessionId, res);

         try {

-            res.getOutputStream().write(results.getBytes("UTF-8"));

+            if (results!=null) {

+                res.getOutputStream().write(results.getBytes("UTF-8"));

+            }

         } catch (IOException e) {

             e.printStackTrace();

         }
NPE protection when writing result/command

r<I>