summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/flood-tool.cpp
diff options
context:
space:
mode:
authorNathan Lee <2431820-nathanal@users.noreply.gitlab.com>2019-04-25 14:30:04 +0000
committerThomas Holder <thomas@thomas-holder.de>2019-04-27 08:51:43 +0000
commit19225039b8667679c175e62f1faa29495b4ed547 (patch)
tree77724af27303ef811f794b1000ea78eea7a26289 /src/ui/tools/flood-tool.cpp
parentFix coding style (diff)
downloadinkscape-19225039b8667679c175e62f1faa29495b4ed547.tar.gz
inkscape-19225039b8667679c175e62f1faa29495b4ed547.zip
Add out of bound checks to fill bucket
Fixes https://gitlab.com/inkscape/inbox/issues/398
Diffstat (limited to 'src/ui/tools/flood-tool.cpp')
-rw-r--r--src/ui/tools/flood-tool.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp
index 6db530917..68987dfcc 100644
--- a/src/ui/tools/flood-tool.cpp
+++ b/src/ui/tools/flood-tool.cpp
@@ -627,7 +627,7 @@ static ScanlineCheckResult perform_bitmap_scanline_check(std::deque<Geom::Point>
bool can_paint_top = (top_ty > 0);
bool can_paint_bottom = (bottom_ty < bci.height);
- Geom::Point t = fill_queue->front();
+ Geom::Point front_of_queue = fill_queue->empty() ? Geom::Point() : fill_queue->front();
do {
ok = false;
@@ -645,8 +645,11 @@ static ScanlineCheckResult perform_bitmap_scanline_check(std::deque<Geom::Point>
paint_directions = paint_pixel(px, trace_px, orig_color, bci, current_trace_t);
if (bci.radius == 0) {
mark_pixel_checked(current_trace_t);
- if ((t[Geom::X] == bci.x) && (t[Geom::Y] == bci.y)) {
- fill_queue->pop_front(); t = fill_queue->front();
+ if ((!fill_queue->empty()) &&
+ (front_of_queue[Geom::X] == bci.x) &&
+ (front_of_queue[Geom::Y] == bci.y)) {
+ fill_queue->pop_front();
+ front_of_queue = fill_queue->empty() ? Geom::Point() : fill_queue->front();
}
}