aboutsummaryrefslogtreecommitdiff
path: root/script.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-04-12 04:00:03 +0700
committerShulhan <ms@kilabit.info>2021-04-12 12:00:01 +0700
commit9cdfa9cd293105ad41345d5dd2af71e7dd10d656 (patch)
tree61021b78074d2662a048e3db292776235f8d6947 /script.go
parentebbc6775c9c5698b18d1f2e08450641945ce26ff (diff)
downloadawwan-9cdfa9cd293105ad41345d5dd2af71e7dd10d656.tar.xz
all: check and return an error if start index is out of range
Diffstat (limited to 'script.go')
-rw-r--r--script.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/script.go b/script.go
index 10c09a9..df669bd 100644
--- a/script.go
+++ b/script.go
@@ -68,6 +68,8 @@ func parseScript(env *environment, content []byte) (s *script, err error) {
}
stmts := bytes.Split(buf.Bytes(), []byte{'\n'})
+ // Add empty line at the beginning to make the start index start from
+ // 1, not 0.
stmts = append([][]byte{{}}, stmts...)
s = &script{