msi: Don't crash if record has no fields.

This commit is contained in:
Juan Lang 2007-09-17 08:02:18 -07:00 committed by Alexandre Julliard
parent 46e2d79508
commit c2d66da665
2 changed files with 13 additions and 2 deletions

View file

@ -626,8 +626,8 @@ UINT MSI_FormatRecordW( MSIPACKAGE* package, MSIRECORD* record, LPWSTR buffer,
TRACE("(%s)\n",debugstr_w(rec));
len = deformat_string_internal(package,rec,&deformated,strlenW(rec),
record, NULL);
len = deformat_string_internal(package,rec,&deformated,
rec ? strlenW(rec) : 0, record, NULL);
if (buffer)
{

View file

@ -388,6 +388,17 @@ static void test_formatrecord(void)
r = MsiFormatRecord(0, 0, NULL, NULL );
ok( r == ERROR_INVALID_HANDLE, "wrong error\n");
hrec = MsiCreateRecord(0);
ok( hrec, "failed to create record\n");
/* format an empty record on a record with no parameters */
sz = sizeof(buffer);
r = MsiFormatRecordA(0, hrec, buffer, &sz );
ok( r == ERROR_SUCCESS, "format failed\n");
ok( sz == 0, "size wrong\n");
MsiCloseHandle( hrec );
hrec = MsiCreateRecord(4);
ok( hrec, "failed to create record\n");