changeset 17138:de926488f244

Avoid NullPointerException
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 16 Sep 2014 18:54:37 -0700
parents ac687cfbed21
children 21fdd914bb8f
files graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Tue Sep 16 18:54:21 2014 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Tue Sep 16 18:54:37 2014 -0700
@@ -50,7 +50,7 @@
      * Gets a global output stream on a file in the current working directory. This stream is first
      * opened if necessary. The name of the file is
      * {@code "compilations-" + System.currentTimeMillis() + ".cfg"}.
-     * 
+     *
      * @return the global output stream or {@code null} if there was an error opening the file for
      *         writing
      */
@@ -70,7 +70,7 @@
 
     /**
      * Creates a control flow graph printer.
-     * 
+     *
      * @param os where the output generated via this printer will be sent
      */
     public CompilationPrinter(OutputStream os) {
@@ -101,7 +101,7 @@
 
     /**
      * Prints a compilation timestamp for a given method.
-     * 
+     *
      * @param method the method for which a timestamp will be printed
      */
     public void printCompilation(JavaMethod method) {
@@ -227,7 +227,7 @@
     }
 
     public void printBytecodes(String code) {
-        if (code.length() == 0) {
+        if (code == null || code.length() == 0) {
             return;
         }
         begin("bytecodes");