Skip to content

Commit fa213ac

Browse files
committed
Handle null PsiDirectory input in GetModuleNameByDirectoryUtil.
1 parent 60e2926 commit fa213ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/magento/idea/magento2plugin/util/magento/GetModuleNameByDirectoryUtil.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ private GetModuleNameByDirectoryUtil() {}
3232
* @return String
3333
*/
3434
public static @Nullable String execute(
35-
final @NotNull PsiDirectory psiDirectory,
35+
final @Nullable PsiDirectory psiDirectory,
3636
final @NotNull Project project
3737
) {
38+
// Gracefully handle null directory inputs from callers
39+
if (psiDirectory == null) {
40+
return null;
41+
}
3842
// Check if directory is theme directory and return module name from directory path if yes
3943
final String path = psiDirectory.getVirtualFile().getPath();
4044
final Pattern pattern = Pattern.compile(RegExUtil.CustomTheme.MODULE_NAME);

0 commit comments

Comments
 (0)