Skip to content

Commit e7214c2

Browse files
committed
Fix the issue by resetting the reloading false first and then returning error directly instead of calling Macro
Fix the review comment Fix the clang format Update as per review comment
1 parent d5ad055 commit e7214c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

modules/gdscript/gdscript.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,12 @@ Error GDScript::reload(bool p_keep_state) {
755755
has_instances = instances.size();
756756
}
757757

758-
ERR_FAIL_COND_V(!p_keep_state && has_instances, ERR_ALREADY_IN_USE);
758+
// Check condition but reset flag before early return
759+
if (!p_keep_state && has_instances) {
760+
reloading = false; // Reset flag before returning
761+
762+
ERR_FAIL_V_MSG(ERR_ALREADY_IN_USE, "Cannot reload script while instances exist.");
763+
}
759764

760765
String basedir = path;
761766

0 commit comments

Comments
 (0)