summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2024-01-26 09:09:00 +0100
committerAlbert Cervin <albert@acervin.com>2024-01-26 09:09:00 +0100
commit880199011075afd4f2d9bd16c7ce42a04741b5b7 (patch)
treed37924b0126901c654366140854dda5c13574823 /src
parent1a5946eca41fbe33df17efc933fa33574af3c3a9 (diff)
downloaddged-880199011075afd4f2d9bd16c7ce42a04741b5b7.tar.gz
dged-880199011075afd4f2d9bd16c7ce42a04741b5b7.tar.xz
dged-880199011075afd4f2d9bd16c7ce42a04741b5b7.zip
Fix clamp not handling negative locations
Diffstat (limited to 'src')
-rw-r--r--src/dged/buffer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dged/buffer.c b/src/dged/buffer.c
index 733d4a4..89e7dad 100644
--- a/src/dged/buffer.c
+++ b/src/dged/buffer.c
@@ -579,6 +579,8 @@ struct location buffer_clamp(struct buffer *buffer, int64_t line, int64_t col) {
location.line = buffer_num_lines(buffer) - 1;
location.col = buffer_num_chars(buffer, location.line);
}
+ } else if (line < 0) {
+ return location;
} else {
location.line = line;
uint32_t nchars = buffer_num_chars(buffer, location.line);