Przeglądaj źródła

[cpp] StringBuf - only flush the charBuf once. Fixes #6018

hughsando 8 lat temu
rodzic
commit
394599d7ee
1 zmienionych plików z 3 dodań i 5 usunięć
  1. 3 5
      std/cpp/_std/StringBuf.hx

+ 3 - 5
std/cpp/_std/StringBuf.hx

@@ -78,13 +78,11 @@ class StringBuf {
 
    public function toString() : String {
       if (charBuf!=null)
-      {
-         if (b==null)
-           return( charBufAsString() );
          flush();
-      }
-      if (b==null)
+      if (b==null || b.length==0)
          return "";
+      if (b.length==1)
+         return b[0];
       return b.join("");
    }