[multiple] Add division by zero guards (#14634)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
authored and GitHub committed 2026-03-09 00:10:48 -04:00
1 parent f3ca86b670
commit 0db9137d91
8 files changed
+38 -7

No files matched your search

+1 -1
View File
@@ -171,7 +171,7 @@ void Graph::draw(Display *buff, uint16_t x_offset, uint16_t y_offset, Color colo
bool prev_b = false;
int16_t prev_y = 0;
for (uint32_t i = 0; i < this->width_; i++) {
float v = (trace->get_tracedata()->get_value(i) - ymin) / yrange;
float v = yrange != 0 ? (trace->get_tracedata()->get_value(i) - ymin) / yrange : NAN;
if (!std::isnan(v) && (thick > 0)) {
int16_t x = this->width_ - 1 - i + x_offset;
uint8_t bit = 1 << ((i % (thick * LineType::PATTERN_LENGTH)) / thick);