]> granicus.if.org Git - handbrake/commitdiff
cli: add an additional null check to silence a clang static analyizer warning.
authorDamiano Galassi <damiog@gmail.com>
Wed, 31 May 2017 09:34:32 +0000 (11:34 +0200)
committerDamiano Galassi <damiog@gmail.com>
Wed, 31 May 2017 09:34:32 +0000 (11:34 +0200)
test/test.c

index d2d791efd4e22e883afbf41f31dc981b4a85dd13..eb1c0ced44468d2297187059126cf679fe2939c0 100644 (file)
@@ -2661,14 +2661,17 @@ static int ParseOptions( int argc, char ** argv )
                 break;
             case 'n':
             {
-                int    i;
-                char * tmp = optarg;
-                for( i = 0; i < 4; i++ )
+                if( optarg != NULL )
                 {
-                    if( !*tmp )
-                        break;
-                    crop[i] = strtol( tmp, &tmp, 0 );
-                    tmp++;
+                    int    i;
+                    char * tmp = optarg;
+                    for( i = 0; i < 4; i++ )
+                    {
+                        if( !*tmp )
+                            break;
+                        crop[i] = strtol( tmp, &tmp, 0 );
+                        tmp++;
+                    }
                 }
                 break;
             }