3321: Mod by zero r=def- a=Jupeyy

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] 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] 2020-11-17 17:08:04 +00:00 committed by GitHub
commit 6e5d0cce6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,7 +32,10 @@ void CRenderTools::RenderEvalEnvelope(CEnvPoint *pPoints, int NumPoints, int Cha
}
int64 MaxPointTime = (int64)pPoints[NumPoints - 1].m_Time * 1000ll;
TimeMicros = TimeMicros % MaxPointTime;
if(MaxPointTime > 0) // TODO: remove this check when implementing a IO check for maps(in this case broken envelopes)
TimeMicros = TimeMicros % MaxPointTime;
else
TimeMicros = 0;
int TimeMillis = (int)(TimeMicros / 1000ll);
for(int i = 0; i < NumPoints - 1; i++)