]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
radiant: fix command-line error message for non-map filename 148/head
authorZack Middleton <zack@cloemail.com>
Tue, 23 Jul 2019 20:32:47 +0000 (15:32 -0500)
committerZack Middleton <zack@cloemail.com>
Tue, 23 Jul 2019 23:01:43 +0000 (18:01 -0500)
mapname wasn't set so "(null)" was printed.

Fixes 6ba43753 ("radiant: fix command-line opening on windows").

radiant/main.cpp

index 172c3fa92db5532fc1062c61b36221cfe1bc04b7..27d9b8af117a0d8ebdd85b88652da7923dfea611 100644 (file)
@@ -537,9 +537,9 @@ int main( int argc, char* argv[] ){
        // Gtk already removed parsed `--options`
        if ( argc == 2 ) {
                if ( strlen( argv[ 1 ] ) > 1 ) {
-                       if ( g_str_has_suffix( argv[ 1 ], ".map" ) ) {
-                               mapname = argv[ 1 ];
+                       mapname = argv[ 1 ];
 
+                       if ( g_str_has_suffix( mapname, ".map" ) ) {
                                if ( !g_path_is_absolute( mapname ) ) {
                                        mapname = g_build_filename( g_get_current_dir(), mapname, NULL );
                                }
@@ -551,6 +551,7 @@ int main( int argc, char* argv[] ){
                        }
                        else {
                                g_print( "bad file name, will not load: %s\n", mapname );
+                               mapname = NULL;
                        }
                }
        }