forked from Miroirs/x49gp
(hopefully) fix segfault on x49gpng --print-config >> ~/.config/x49gpng/config.lua
This commit is contained in:
parent
6089396a7a
commit
62458e2b11
1 changed files with 20 additions and 20 deletions
|
@ -282,27 +282,7 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
opt.model = MODEL_49GP;
|
||||
if ( strcmp( svalue_model, "49gp-newrpl" ) == 0 )
|
||||
opt.model = MODEL_49GP_NEWRPL;
|
||||
}
|
||||
|
||||
lua_getglobal( config_lua_values, "name" );
|
||||
opt.name = strdup( luaL_optstring( config_lua_values, -1, NULL ) );
|
||||
|
||||
lua_getglobal( config_lua_values, "font" );
|
||||
opt.font = strdup( luaL_optstring( config_lua_values, -1, NULL ) );
|
||||
|
||||
lua_getglobal( config_lua_values, "text_scale" );
|
||||
opt.text_scale = luaL_optinteger( config_lua_values, -1, 1.0 );
|
||||
|
||||
lua_getglobal( config_lua_values, "display_scale" );
|
||||
opt.display_scale = luaL_optinteger( config_lua_values, -1, 1.0 );
|
||||
}
|
||||
|
||||
/****************************************************/
|
||||
/* 2. treat command-line params which have priority */
|
||||
/****************************************************/
|
||||
if ( clopt_name != NULL )
|
||||
opt.name = strdup( clopt_name );
|
||||
else
|
||||
switch ( opt.model ) {
|
||||
case MODEL_50G_NEWRPL:
|
||||
opt.name = "HP 50g / newRPL";
|
||||
|
@ -318,6 +298,26 @@ void config_init( char* progname, int argc, char* argv[] )
|
|||
opt.name = "HP 50g";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lua_getglobal( config_lua_values, "name" );
|
||||
opt.name = strdup( luaL_optstring( config_lua_values, -1, opt.name ) );
|
||||
|
||||
lua_getglobal( config_lua_values, "font" );
|
||||
opt.font = strdup( luaL_optstring( config_lua_values, -1, opt.font ) );
|
||||
|
||||
lua_getglobal( config_lua_values, "text_scale" );
|
||||
opt.text_scale = luaL_optinteger( config_lua_values, -1, 1 );
|
||||
|
||||
lua_getglobal( config_lua_values, "display_scale" );
|
||||
opt.display_scale = luaL_optinteger( config_lua_values, -1, 2 );
|
||||
}
|
||||
|
||||
/****************************************************/
|
||||
/* 2. treat command-line params which have priority */
|
||||
/****************************************************/
|
||||
if ( clopt_name != NULL )
|
||||
opt.name = strdup( clopt_name );
|
||||
if ( clopt_font != NULL )
|
||||
opt.font = strdup( clopt_font );
|
||||
if ( clopt_model != -1 )
|
||||
|
|
Loading…
Reference in a new issue