[haiku-commits] r40525 - haiku/trunk/src/kits/support

  • From: zooey@xxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 16 Feb 2011 11:11:50 +0100 (CET)

Author: zooey
Date: 2011-02-16 11:11:49 +0100 (Wed, 16 Feb 2011)
New Revision: 40525
Changeset: http://dev.haiku-os.org/changeset/40525
Ticket: http://dev.haiku-os.org/ticket/7226

Modified:
   haiku/trunk/src/kits/support/String.cpp
Log:
Fix minor issue in BString I noticed when researching #7226:
* if _MakeWritable() fails, LockBuffer() must return NULL, not what
  happens to be in fPrivateData

Modified: haiku/trunk/src/kits/support/String.cpp
===================================================================
--- haiku/trunk/src/kits/support/String.cpp     2011-02-15 23:05:10 UTC (rev 
40524)
+++ haiku/trunk/src/kits/support/String.cpp     2011-02-16 10:11:49 UTC (rev 
40525)
@@ -1787,10 +1787,12 @@
        if (maxLength > length)
                length = maxLength;
 
-       if (_MakeWritable(length, true) == B_OK) {
-               _ReferenceCount() = -1;
-                       // mark unshareable
-       }
+       if (_MakeWritable(length, true) != B_OK)
+               return NULL;
+
+       _ReferenceCount() = -1;
+               // mark unshareable
+
        return fPrivateData;
 }
 


Other related posts:

  • » [haiku-commits] r40525 - haiku/trunk/src/kits/support - zooey