Skip to content

Commit

Permalink
Check if global class file still exists before registering it
Browse files Browse the repository at this point in the history
(cherry picked from commit e264ae2)
  • Loading branch information
Rubonnek authored and akien-mga committed Jul 29, 2020
1 parent 36b746d commit 4f9ca00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/script_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "script_language.h"

#include "core/core_string_names.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"

ScriptLanguage *ScriptServer::_languages[MAX_LANGUAGES];
Expand Down Expand Up @@ -166,7 +167,7 @@ void ScriptServer::init_languages() {

for (int i = 0; i < script_classes.size(); i++) {
Dictionary c = script_classes[i];
if (!c.has("class") || !c.has("language") || !c.has("path") || !c.has("base"))
if (!c.has("class") || !c.has("language") || !c.has("path") || !FileAccess::exists(c["path"]) || !c.has("base"))

This comment has been minimized.

Copy link
@Faless

Faless Aug 3, 2020

Collaborator

This seems to be the cause of #40991. Probably due to path being remapped from *.gd to *.gdc (or *.gde in case of encryption).

This comment has been minimized.

Copy link
@reduz

reduz Aug 19, 2020

Member

Yes, path remap can break things so never, ever use File::exists for these things. Use Resource::exists instead.

continue;
add_global_class(c["class"], c["base"], c["language"], c["path"]);
}
Expand Down

0 comments on commit 4f9ca00

Please sign in to comment.