1
0
mirror of synced 2024-11-13 18:50:53 +01:00

Allow zero-sized arrays again

This commit is contained in:
WerWolv 2021-01-04 16:25:03 +01:00
parent f5250d6bcf
commit f137d759c8

View File

@ -358,12 +358,10 @@ namespace hex::lang {
this->m_currEndian.reset();
if (entries.empty())
throwEvaluateError("array size must be greater than zero", node->getLineNumber());
PatternData *pattern;
if (dynamic_cast<PatternDataCharacter*>(entries[0]))
if (entries.empty())
pattern = new PatternDataPadding(startOffset, 0);
else if (dynamic_cast<PatternDataCharacter*>(entries[0]))
pattern = new PatternDataString(startOffset, (this->m_currOffset - startOffset), color.value_or(0));
else
pattern = new PatternDataArray(startOffset, (this->m_currOffset - startOffset), entries, color.value_or(0));