diff --git a/input/input_autodetect.c b/input/input_autodetect.c
index 1dfbd30969..a67fbbe547 100644
--- a/input/input_autodetect.c
+++ b/input/input_autodetect.c
@@ -90,7 +90,7 @@ static bool input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
    }
 
    /* Check for name match - name starts with ident */
-   if (!strncmp(params->name, ident, strlen(ident)))
+   if (ident[0] != '\0' && !strncmp(params->name, ident, strlen(ident)))
    {
       BIT32_SET(*match, AUTODETECT_MATCH_IDENT);
       ret = true;