Check for index < 0 too for B_BAD_INDEX. This fixes for example Tracker-Grep

which does

message->GetInfo("field", &type, &count);
while (message->FindBlah("field", --count, &...) == B_OK)
	...;



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-07-31 10:54:08 +00:00
parent 274e684a8e
commit d666a89e8f
+1 -1
View File
@@ -1754,7 +1754,7 @@ BMessage::FindData(const char *name, type_code type, int32 index,
if (!field)
return B_ERROR;
if (index >= field->count)
if (index < 0 || index >= field->count)
return B_BAD_INDEX;
if (field->flags & FIELD_FLAG_FIXED_SIZE) {