We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae1f414 commit 4370b80Copy full SHA for 4370b80
crates/languages/bevy_mod_scripting_lua/src/lib.rs
@@ -261,11 +261,14 @@ pub fn lua_handler(
261
w.resource::<ScriptEnvironmentStore>()
262
.map
263
.get(script_id)
264
- .unwrap()
265
- .clone()
+ .ok_or(ScriptError::new(format!(
+ "Could not find environment for script with ScriptId: {}",
266
+ script_id
267
+ )))
268
+ .cloned()
269
})?;
270
- let handler: Function = match env.raw_get(callback_label.as_ref()) {
271
+ let handler: Function = match env?.raw_get(callback_label.as_ref()) {
272
Ok(handler) => handler,
273
// not subscribed to this event type
274
Err(_) => {
0 commit comments