From 773dfeba460ddea9bc5de86bf59f4e442bff9df2 Mon Sep 17 00:00:00 2001 From: s-ol Date: Sun, 2 Feb 2020 17:25:40 +0100 Subject: fix crashes caused by code errors --- registry.moon | 6 ++++-- scope.moon | 2 +- 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}'" -- cgit v1.2.3