3956: Fix out of bounds in editor render image r=heinrich5991 a=Jupeyy

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Jupeyy <jupjopjap@gmail.com>
This commit is contained in:
bors[bot] 2021-07-24 11:34:53 +00:00 committed by GitHub
commit 95c936d6c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3956,7 +3956,7 @@ void CEditor::RenderImages(CUIRect ToolBox, CUIRect View)
// render image
int i = m_SelectedImage;
if(i < m_Map.m_lImages.size())
if(i != -1 && i < m_Map.m_lImages.size())
{
CUIRect r;
View.Margin(10.0f, &r);