Skip to content

fix: prevent fatal error in module_path helper when module not found - #2162

Open
YoussefMansour9 wants to merge 1 commit into
nWidart:masterfrom
YoussefMansour9:fix/module-path-null-safe-v2
Open

fix: prevent fatal error in module_path helper when module not found#2162
YoussefMansour9 wants to merge 1 commit into
nWidart:masterfrom
YoussefMansour9:fix/module-path-null-safe-v2

Conversation

@YoussefMansour9

Copy link
Copy Markdown

Description

When the module_path() helper is called before the module registry is fully resolved during bootstrap (e.g. on NativePHP Android runtime), app("modules")->find($name) returns null, causing a Call to a member function getPath() on null fatal error.

Fix

Add a null check before calling getPath(). If the module is not found, fall back to the default Modules/{name} path.

Related Issue

Closes #2158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential Fatal Error in module_path helper during bootstrap (null-safe fix)

1 participant