summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2017-10-16 21:55:42 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2017-10-16 21:55:42 +0200
commit7764640f2241b5972a48665ff2e0d001aff0993c (patch)
treeedcceb9d9167d0d17286fb1f4b67e9e30667bfef
parent8de1dc7e9a1d137d9904122e775c270b03f4e049 (diff)
Fix crash in shader parsing
...that would happen if incorrect syntax was found just after an opening square bracket. Fixes #12046.
-rw-r--r--servers/visual/shader_language.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp
index b2a11deea1..8fee6050a0 100644
--- a/servers/visual/shader_language.cpp
+++ b/servers/visual/shader_language.cpp
@@ -2586,6 +2586,8 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons
} else if (tk.type == TK_BRACKET_OPEN) {
Node *index = _parse_and_reduce_expression(p_block, p_builtin_types);
+ if (!index)
+ return NULL;
if (index->get_datatype() != TYPE_INT && index->get_datatype() != TYPE_UINT) {
_set_error("Only integer datatypes are allowed for indexing");