RegDeleteKey fails if the lpSubKey param is NULL.

diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c
index eaffa0e..c47be98 100644
--- a/dlls/advapi32/registry.c
+++ b/dlls/advapi32/registry.c
@@ -871,9 +871,11 @@
     DWORD ret;
     HKEY tmp;
 
+    if (!name) return ERROR_INVALID_PARAMETER;
+
     if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
 
-    if (!name || !*name)
+    if (!*name)
     {
         ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
     }
@@ -905,9 +907,11 @@
     DWORD ret;
     HKEY tmp;
 
+    if (!name) return ERROR_INVALID_PARAMETER;
+
     if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE;
 
-    if (!name || !*name)
+    if (!*name)
     {
         ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) );
     }