From a638715bd87d818d134a70659e7124234b992447 Mon Sep 17 00:00:00 2001 From: nosamu <71368227+n0samu@users.noreply.github.com> Date: Sat, 13 Jan 2024 12:47:39 -0600 Subject: [PATCH] avm2: Throw null param error in navigateToURL Fixes #14733 --- core/src/avm2/globals/flash/net.rs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/core/src/avm2/globals/flash/net.rs b/core/src/avm2/globals/flash/net.rs index 425995bc9..4ab8b8b8c 100644 --- a/core/src/avm2/globals/flash/net.rs +++ b/core/src/avm2/globals/flash/net.rs @@ -1,5 +1,6 @@ //! `flash.net` namespace +use crate::avm2::error::type_error; use crate::avm2::object::TObject; use crate::avm2::{Activation, Error, Object, Value}; @@ -29,15 +30,20 @@ pub fn navigate_to_url<'gc>( .ok_or("navigateToURL: not enough arguments")? .coerce_to_string(activation)?; - let url = request - .get_public_property("url", activation)? - .coerce_to_string(activation)?; - - activation.context.navigator.navigate_to_url( - &url.to_utf8_lossy(), - &target.to_utf8_lossy(), - None, - ); - - Ok(Value::Undefined) + match request.get_public_property("url", activation)? { + Value::Null => Err(Error::AvmError(type_error( + activation, + "Error #2007: Parameter url must be non-null.", + 2007, + )?)), + url => { + let url = url.coerce_to_string(activation)?; + activation.context.navigator.navigate_to_url( + &url.to_utf8_lossy(), + &target.to_utf8_lossy(), + None, + ); + Ok(Value::Undefined) + } + } }