* Reset the passed string on failure for BeOS compatibility.
* Fixes #7701. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42200 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2010, Haiku Inc. All rights reserved.
|
* Copyright 2005-2011, Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -2632,12 +2632,15 @@ BMessage::FindString(const char *name, int32 index, BString *string) const
|
|||||||
if (string == NULL)
|
if (string == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
const char *cstr;
|
const char *value;
|
||||||
status_t error = FindString(name, index, &cstr);
|
status_t error = FindString(name, index, &value);
|
||||||
if (error < B_OK)
|
if (error != B_OK) {
|
||||||
|
// Find*() clobbers the object even on failure
|
||||||
|
string->Truncate(0);
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
*string = cstr;
|
*string = value;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user