aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-02-02 16:25:40 +0000
committers-ol <s-ol@users.noreply.github.com>2020-02-02 16:25:40 +0000
commit773dfeba460ddea9bc5de86bf59f4e442bff9df2 (patch)
treeeb587fb2c3e8cdce6a05da9a0e0e0223315d5713
parentfix README (diff)
downloadalive-773dfeba460ddea9bc5de86bf59f4e442bff9df2.tar.gz
alive-773dfeba460ddea9bc5de86bf59f4e442bff9df2.zip
fix crashes caused by code errors
-rw-r--r--registry.moon6
-rw-r--r--scope.moon2
2 files changed, 5 insertions, 3 deletions
diff --git a/registry.moon b/registry.moon
index 2a751cc..7268f6d 100644
--- a/registry.moon
+++ b/registry.moon
@@ -96,8 +96,10 @@ class Registry
update: (dt) =>
for typ, sexpr in @root\walk 'inout', false
continue unless typ == 'Xpr'
- -- continue unless sexpr.value and sexpr.value.update
- continue unless sexpr\head!.type == 'opdef'
+
+ head = sexpr\head!
+ continue unless head and head.type == 'opdef'
+ continue unless sexpr.value
ok, err = xpcall sexpr.value.update, tb, sexpr.value, dt
if not ok
diff --git a/scope.moon b/scope.moon
index 907269e..bba2db4 100644
--- a/scope.moon
+++ b/scope.moon
@@ -60,7 +60,7 @@ class Scope
start, rest = key\match '^(.-)/(.*)'
if not start
- return @parent\get key
+ return @parent and @parent\get key
scope = @get start
assert scope and scope.type == 'scope', "cant find '#{prefix}#{start}' for '#{prefix}#{key}'"