Index: source/gui/CGUI.cpp =================================================================== --- source/gui/CGUI.cpp +++ source/gui/CGUI.cpp @@ -950,12 +950,14 @@ CStrW directory(Element.GetAttributes().GetNamedItem(pFile->GetAttributeID("directory")).FromUTF8()); if (!directory.empty()) { - VfsPaths pathnames; - vfs::GetPathnames(g_VFS, directory, L"*.js", pathnames); - for (const VfsPath& path : pathnames) + if (VfsPath(directory).IsDirectory()) { - // Only load new files (so when the insert succeeds) - if (Paths.insert(path).second) + VfsPaths pathnames; + vfs::GetPathnames(g_VFS, directory, L"*.js", pathnames); + for (const VfsPath& path : pathnames) + { + // Only load new files (so when the insert succeeds) + if (Paths.insert(path).second) try { m_ScriptInterface->LoadGlobalScriptFile(path); @@ -964,7 +966,10 @@ { LOGERROR("GUI: Error executing script %s: %s", path.string8(), e.what()); } + } } + else + LOGERROR("GUI: Script directory %s is not a directory", directory.ToUTF8()); } // Execute inline scripts