summaryrefslogtreecommitdiff
path: root/line-range.c
diff options
context:
space:
mode:
Diffstat (limited to 'line-range.c')
-rw-r--r--line-range.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/line-range.c b/line-range.c
index ede0c6c98f..de4e32f942 100644
--- a/line-range.c
+++ b/line-range.c
@@ -54,8 +54,11 @@ static const char *parse_loc(const char *spec, nth_line_fn_t nth_line,
}
num = strtol(spec, &term, 10);
if (term != spec) {
- if (ret)
+ if (ret) {
+ if (num <= 0)
+ die("-L invalid line number: %ld", num);
*ret = num;
+ }
return term;
}