mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
refactor: Remove IsArgSet guard when fallback value is provided
Checking for IsArgSet before calling GetArg while providing the args default value as fallback is both confusing and fragile. It is confusing, because the provided fallback is dead code. So it would be better to just call GetArg without a fallback. However, ignoring the fallback value is fragile, because it would not be sanitized. Fix all issues by sanitizing the fallback value.
This commit is contained in:
@@ -1059,7 +1059,7 @@ static void ParseGetInfoResult(UniValue& result)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gArgs.IsArgSet("-color")) {
|
||||
{
|
||||
const std::string color{gArgs.GetArg("-color", DEFAULT_COLOR_SETTING)};
|
||||
if (color == "always") {
|
||||
should_colorize = true;
|
||||
|
||||
Reference in New Issue
Block a user