aboutsummaryrefslogtreecommitdiff
path: root/src/libmain/shared.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmain/shared.hh')
-rw-r--r--src/libmain/shared.hh7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libmain/shared.hh b/src/libmain/shared.hh
index ffae5d796..38f627b44 100644
--- a/src/libmain/shared.hh
+++ b/src/libmain/shared.hh
@@ -70,10 +70,9 @@ template<class N> N getIntArg(const string & opt,
s.resize(s.size() - 1);
}
}
- N n;
- if (!string2Int(s, n))
- throw UsageError("'%1%' requires an integer argument", opt);
- return n * multiplier;
+ if (auto n = string2Int<N>(s))
+ return *n * multiplier;
+ throw UsageError("'%1%' requires an integer argument", opt);
}