msi: Don't crash on null last parameter in MsiDecomposeDescriptor.
diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c
index 1cbdcc9..e0a50a3 100644
--- a/dlls/msi/registry.c
+++ b/dlls/msi/registry.c
@@ -1156,7 +1156,7 @@
len = ( &p[21] - szDescriptor );
TRACE("length = %d\n", len);
- *pUsed = len;
+ if (pUsed) *pUsed = len;
return ERROR_SUCCESS;
}
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 8df17e8..5571a71 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -479,6 +479,9 @@
r = pMsiDecomposeDescriptorA(NULL, NULL, NULL, NULL, &len);
ok(r == ERROR_INVALID_PARAMETER, "returned wrong error\n");
ok(len == 0, "length wrong\n");
+
+ r = pMsiDecomposeDescriptorA(desc, NULL, NULL, NULL, NULL);
+ ok(r == ERROR_SUCCESS, "returned wrong error\n");
}
static UINT try_query_param( MSIHANDLE hdb, LPCSTR szQuery, MSIHANDLE hrec )