ImpulseAdventure / GUIslice

GUIslice drag & drop embedded GUI in C for touchscreen TFT on Arduino, Raspberry Pi, ARM, ESP8266 / ESP32 / M5stack using Adafruit-GFX / TFT_eSPI / UTFT / SDL
https://www.impulseadventure.com/elec/guislice-gui.html
MIT License
1.2k stars 211 forks source link

div-by-zer on XGraph with (still) 0 points. #439

Closed dirkx closed 2 years ago

dirkx commented 2 years ago

Describe the bug

An empty / nBufMax == 0 graph will cause a div-by-zero error on display update/rendering in line 300 of XGraph.h.

It may be useful to change this line to:

pBox->nPlotIndStart = pBox->nBufMax ? (pBox->nPlotIndStart % pBox->nBufMax) : 0; as the remainder is quite robust and able to display thing sensibly.

ImpulseAdventure commented 2 years ago

Thank you for the correction, @dirkx I have rolled this update into the latest.