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
This commit is contained in:
Oliver Tappe 2011-02-16 10:11:49 +00:00
parent c44a2a9a25
commit 9f209e77b8

View File

@ -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;
}