Commit e495e7e3 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

Setting a record to an empty string is the same as making it null.

parent 026b786e
......@@ -455,7 +455,7 @@ UINT MSI_RecordSetStringA( MSIRECORD *rec, unsigned int iField, LPCSTR szValue )
return ERROR_INVALID_FIELD;
MSI_FreeField( &rec->fields[iField] );
if( szValue )
if( szValue && szValue[0] )
{
len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 );
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
......@@ -501,7 +501,7 @@ UINT MSI_RecordSetStringW( MSIRECORD *rec, unsigned int iField, LPCWSTR szValue
MSI_FreeField( &rec->fields[iField] );
if( szValue )
if( szValue && szValue[0] )
{
len = lstrlenW(szValue) + 1;
str = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR));
......
......@@ -123,6 +123,10 @@ void test_msirecord(void)
ok(r == ERROR_SUCCESS, "Failed to set null string at 0\n");
r = MsiRecordIsNull(h, 0);
ok(r == TRUE, "null string not null field\n");
r = MsiRecordSetString(h, 0, "");
ok(r == ERROR_SUCCESS, "Failed to set empty string at 0\n");
r = MsiRecordIsNull(h, 0);
ok(r == TRUE, "null string not null field\n");
r = MsiRecordSetString(h,0,str);
ok(r == ERROR_SUCCESS, "Failed to set string at 0\n");
r = MsiRecordGetInteger(h, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment