Author: axeld Date: 2011-06-15 23:02:31 +0200 (Wed, 15 Jun 2011) New Revision: 42200 Changeset: https://dev.haiku-os.org/changeset/42200 Ticket: https://dev.haiku-os.org/ticket/7701 Modified: haiku/trunk/src/kits/app/Message.cpp Log: * Reset the passed string on failure for BeOS compatibility. * Fixes #7701. Modified: haiku/trunk/src/kits/app/Message.cpp =================================================================== --- haiku/trunk/src/kits/app/Message.cpp 2011-06-15 20:51:32 UTC (rev 42199) +++ haiku/trunk/src/kits/app/Message.cpp 2011-06-15 21:02:31 UTC (rev 42200) @@ -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. * * Authors: @@ -2632,12 +2632,15 @@ if (string == NULL) return B_BAD_VALUE; - const char *cstr; - status_t error = FindString(name, index, &cstr); - if (error < B_OK) + const char *value; + status_t error = FindString(name, index, &value); + if (error != B_OK) { + // Find*() clobbers the object even on failure + string->Truncate(0); return error; + } - *string = cstr; + *string = value; return B_OK; }