From b43e92afa5bbd1cbd62e9d8bbceda2dc0f4a6ebc Mon Sep 17 00:00:00 2001 From: neeldug <5161147+neeldug@users.noreply.github.com> Date: Tue, 16 Jun 2020 21:33:43 +0100 Subject: [PATCH] Added error propagation in Field access (#500) --- boa/src/exec/field/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/boa/src/exec/field/mod.rs b/boa/src/exec/field/mod.rs index ee5b548926..9e3344c926 100644 --- a/boa/src/exec/field/mod.rs +++ b/boa/src/exec/field/mod.rs @@ -8,9 +8,7 @@ impl Executable for GetConstField { fn run(&self, interpreter: &mut Interpreter) -> ResultValue { let mut obj = self.obj().run(interpreter)?; if obj.get_type() != Type::Object || obj.get_type() != Type::Symbol { - obj = interpreter - .to_object(&obj) - .expect("failed to convert to object"); + obj = interpreter.to_object(&obj)?; } Ok(obj.get_field(self.field())) @@ -21,9 +19,7 @@ impl Executable for GetField { fn run(&self, interpreter: &mut Interpreter) -> ResultValue { let mut obj = self.obj().run(interpreter)?; if obj.get_type() != Type::Object || obj.get_type() != Type::Symbol { - obj = interpreter - .to_object(&obj) - .expect("failed to convert to object"); + obj = interpreter.to_object(&obj)?; } let field = self.field().run(interpreter)?;