Skip to content

Commit

Permalink
Merge pull request #88020 from emre0altan/match-null-crashes-GDScript…
Browse files Browse the repository at this point in the history
…-compiler

GDScript: Set `has_type` false if it is `BUILTIN` but `Variant::NIL`
  • Loading branch information
akien-mga committed Feb 23, 2024
2 parents 4582ee1 + 081fa32 commit 7766628
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/gdscript/gdscript_byte_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void GDScriptByteCodeGenerator::set_initial_line(int p_line) {
(m_var.type.has_type && m_var.type.kind == GDScriptDataType::BUILTIN)

#define IS_BUILTIN_TYPE(m_var, m_type) \
(m_var.type.has_type && m_var.type.kind == GDScriptDataType::BUILTIN && m_var.type.builtin_type == m_type)
(m_var.type.has_type && m_var.type.kind == GDScriptDataType::BUILTIN && m_var.type.builtin_type == m_type && m_type != Variant::NIL)

void GDScriptByteCodeGenerator::write_type_adjust(const Address &p_target, Variant::Type p_new_type) {
switch (p_new_type) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
func test():
match null:
null:
print('null matched')
_:
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GDTEST_OK
null matched

0 comments on commit 7766628

Please sign in to comment.