Skip to content

Commit

Permalink
sapi: Handle zero-length attributes correctly in ISpObjectTokenCatego…
Browse files Browse the repository at this point in the history
…ry::EnumTokens.
  • Loading branch information
shaunren authored and julliard committed Feb 20, 2024
1 parent 5243f2e commit 4bbfd83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions dlls/sapi/tests/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ static void test_token_category(void)

IEnumSpObjectTokens_Release( enum_tokens );

hr = ISpObjectTokenCategory_EnumTokens( cat, L"", NULL, &enum_tokens );
ok( hr == S_OK, "got %08lx\n", hr );

count = 0xdeadbeef;
hr = IEnumSpObjectTokens_GetCount( enum_tokens, &count );
ok( hr == S_OK, "got %08lx\n", hr );
ok( count == 5, "got %lu\n", count );

IEnumSpObjectTokens_Release( enum_tokens );

hr = ISpObjectTokenCategory_EnumTokens( cat, L"Language=409", NULL, &enum_tokens );
ok( hr == S_OK, "got %08lx\n", hr );

Expand Down
2 changes: 1 addition & 1 deletion dlls/sapi/token.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ static HRESULT score_attributes( ISpObjectToken *token, const WCHAR *attrs,
unsigned int i, j;
HRESULT hr;

if (!attrs)
if (!attrs || !*attrs)
{
*score = 1;
return S_OK;
Expand Down

0 comments on commit 4bbfd83

Please sign in to comment.