diff -urp libmetalink-0.1.3.orig/lib/metalink_pstate.c libmetalink-0.1.3/lib/metalink_pstate.c
--- libmetalink-0.1.3.orig/lib/metalink_pstate.c	2012-08-12 04:43:53.000000000 -0400
+++ libmetalink-0.1.3/lib/metalink_pstate.c	2020-07-22 17:03:21.205852103 -0400
@@ -100,7 +100,7 @@ void initial_state_start_fun(metalink_ps
 			     const char** attrs)
 {
   if(strcmp("metalink", name) == 0) {
-    if (strcmp(METALINK_V3_NS_URI, ns_uri) == 0) {
+    if (ns_uri && strcmp(METALINK_V3_NS_URI, ns_uri) == 0) {
       const char* type;
       const char* origin;
       metalink_pctrl_set_version(stm->ctrl, METALINK_VERSION_3);
@@ -116,7 +116,7 @@ void initial_state_start_fun(metalink_ps
 
       metalink_pstm_enter_metalink_state(stm);
     }
-    else if (strcmp(METALINK_V4_NS_URI, ns_uri) == 0) {
+    else if (ns_uri && strcmp(METALINK_V4_NS_URI, ns_uri) == 0) {
       metalink_pctrl_set_version(stm->ctrl, METALINK_VERSION_4);
       metalink_pstm_enter_metalink_state_v4(stm);
     } else {
