Fix invalid memory access when getting the main entry of empty registers

Fixes #3370
This commit is contained in:
Maxime Coste 2020-02-15 15:40:40 +11:00
parent e9cf0f23f2
commit 940b1b6175

View File

@ -48,7 +48,8 @@ public:
const String& get_main(const Context& context, size_t main_index) override const String& get_main(const Context& context, size_t main_index) override
{ {
return get(context)[std::min(main_index, m_content.size() - 1)]; auto content = get(context);
return content[std::min(main_index, content.size() - 1)];
} }
protected: protected: