From 9f209e77b87c431e19a86c199bee726c85d682ae Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 16 Feb 2011 10:11:49 +0000 Subject: [PATCH] Fix minor issue in BString I noticed when researching #7226: * if _MakeWritable() fails, LockBuffer() must return NULL, not what happens to be in fPrivateData git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40525 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/support/String.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kits/support/String.cpp b/src/kits/support/String.cpp index 4a1717f100..67dd1e7a0d 100644 --- a/src/kits/support/String.cpp +++ b/src/kits/support/String.cpp @@ -1787,10 +1787,12 @@ BString::LockBuffer(int32 maxLength) 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; }