Skip to content

Commit

Permalink
Merge pull request #36926 from BevapDin/uos
Browse files Browse the repository at this point in the history
Properly initialize members of options_manager::cOpt
  • Loading branch information
ZhilkinSerg authored Jan 11, 2020
2 parents 57b7dbe + f13a987 commit 40fa342
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,32 @@ void options_manager::add_external( const std::string &sNameIn, const std::strin
thisOpt.sMenuText = sMenuTextIn;
thisOpt.sTooltip = sTooltipIn;
thisOpt.sType = sType;
thisOpt.verbose = false;

thisOpt.eType = get_value_type( thisOpt.sType );

thisOpt.iMin = INT_MIN;
thisOpt.iMax = INT_MAX;

thisOpt.fMin = INT_MIN;
thisOpt.fMax = INT_MAX;
switch( thisOpt.eType ) {
case cOpt::CVT_BOOL:
thisOpt.bSet = false;
thisOpt.bDefault = false;
break;
case cOpt::CVT_INT:
thisOpt.iMin = INT_MIN;
thisOpt.iMax = INT_MAX;
thisOpt.iDefault = 0;
thisOpt.iSet = 0;
break;
case cOpt::CVT_FLOAT:
thisOpt.fMin = INT_MIN;
thisOpt.fMax = INT_MAX;
thisOpt.fDefault = 0;
thisOpt.fSet = 0;
thisOpt.fStep = 1;
break;
default:
// all other type-specific values have default constructors
break;
}

thisOpt.hide = COPT_ALWAYS_HIDE;
thisOpt.setSortPos( sPageIn );
Expand Down

0 comments on commit 40fa342

Please sign in to comment.