[nostalgia/core] Fix possible div by zero in idxToPt
This commit is contained in:
parent
cef415d34f
commit
ea55a33b60
@ -28,6 +28,10 @@ constexpr std::size_t ptToIdx(const geo::Point &pt, int c) noexcept {
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr geo::Point idxToPt(int i, int c) noexcept {
|
||||
// prevent divide by zeros
|
||||
if (!c) {
|
||||
++c;
|
||||
}
|
||||
const auto t = i / PixelsPerTile; // tile number
|
||||
const auto iti = i % PixelsPerTile; // in tile index
|
||||
const auto tc = t % c; // tile column
|
||||
|
Loading…
Reference in New Issue
Block a user