aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--present/code.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/present/code.go b/present/code.go
index edf2ee421..681aaa005 100644
--- a/present/code.go
+++ b/present/code.go
@@ -89,6 +89,11 @@ func parseCode(ctx *Context, sourceFile string, sourceLine int, cmd string) (Ele
if err != nil {
return nil, fmt.Errorf("%s:%d: %v", sourceFile, sourceLine, err)
}
+ if lo > hi {
+ // The search in addrToByteRange can wrap around so we might
+ // end up with the range ending before its starting point
+ hi, lo = lo, hi
+ }
// Acme pattern matches can stop mid-line,
// so run to end of line in both directions if not at line start/end.