diff --git a/modules/lua/libs/osd.c b/modules/lua/libs/osd.c
index 1f9d937ea4ae2374868e181875f716df49e8a00f..ad02fbcf258155c07eb708755edb4cf9babb7296 100644
--- a/modules/lua/libs/osd.c
+++ b/modules/lua/libs/osd.c
@@ -96,9 +96,8 @@ static int vlc_osd_position_from_string( const char *psz_name )
           { SUBPICTURE_ALIGN_TOP   |SUBPICTURE_ALIGN_RIGHT, "top-right"    },
           { SUBPICTURE_ALIGN_BOTTOM|SUBPICTURE_ALIGN_LEFT,  "bottom-left"  },
           { SUBPICTURE_ALIGN_BOTTOM|SUBPICTURE_ALIGN_RIGHT, "bottom-right" },
-          { 0, NULL } };
-    int i;
-    for( i = 0; pp_icons[i].psz_name; i++ )
+        };
+    for( size_t i = 0; i < ARRAY_SIZE(pp_icons); i++ )
     {
         if( !strcmp( psz_name, pp_icons[i].psz_name ) )
             return pp_icons[i].i_position;