have cstring() return null if passed a null pointer
authorDavid Crawshaw <david@zentus.com>
Sat, 18 Nov 2006 02:09:59 +0000 (18:09 -0800)
committerDavid Crawshaw <david@zentus.com>
Sat, 18 Nov 2006 02:09:59 +0000 (18:09 -0800)
darcs-hash:20061118020959-0c629-68cc6e9336b7c981bc3ddd49ffc43978f39163c6.gz

src/org/ibex/nestedvm/Runtime.java

index 4618dc3..5c2cc6a 100644 (file)
@@ -1252,6 +1252,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     
     /** Helper function to read a cstring from main memory */
     public final String cstring(int addr) throws ReadFaultException {
+        if (addr == 0) return null;
         StringBuffer sb = new StringBuffer();
         for(;;) {
             int word = memRead(addr&~3);