Skip to content

Commit

Permalink
Merge pull request #238 from jdemel/fix-small-file-crash
Browse files Browse the repository at this point in the history
traceplot: Fix divide by zero crash
  • Loading branch information
miek authored Jul 30, 2024
2 parents 6a1ee5a + 7830cde commit c6f4ecf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/traceplot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void TracePlot::paintMid(QPainter &painter, QRect &rect, range_t<size_t> sampleR
{
if (sampleRange.length() == 0) return;

int samplesPerColumn = sampleRange.length() / rect.width();
int samplesPerColumn = std::max(1UL, sampleRange.length() / rect.width());
int samplesPerTile = tileWidth * samplesPerColumn;
size_t tileID = sampleRange.minimum / samplesPerTile;
size_t tileOffset = sampleRange.minimum % samplesPerTile; // Number of samples to skip from first image tile
Expand Down

0 comments on commit c6f4ecf

Please sign in to comment.