Skip to content

Commit 50edb33

Browse files
fix exception types in Image.cc
1 parent 72b6445 commit 50edb33

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Image.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,13 +1118,13 @@ void Image::draw_line(ssize_t x0, ssize_t y0, ssize_t x1, ssize_t y1,
11181118
if (steep) {
11191119
try {
11201120
this->write_pixel(y, x, r, g, b, a);
1121-
} catch (const runtime_error& e) {
1121+
} catch (const out_of_range& e) {
11221122
return;
11231123
}
11241124
} else {
11251125
try {
11261126
this->write_pixel(x, y, r, g, b, a);
1127-
} catch (const runtime_error& e) {
1127+
} catch (const out_of_range& e) {
11281128
return;
11291129
}
11301130
}
@@ -1152,7 +1152,7 @@ void Image::draw_horizontal_line(ssize_t x1, ssize_t x2, ssize_t y,
11521152
}
11531153
try {
11541154
this->write_pixel(x, y, r, g, b, a);
1155-
} catch (const runtime_error& e) {
1155+
} catch (const out_of_range& e) {
11561156
break;
11571157
}
11581158
}
@@ -1172,7 +1172,7 @@ void Image::draw_vertical_line(ssize_t x, ssize_t y1, ssize_t y2,
11721172
}
11731173
try {
11741174
this->write_pixel(x, y, r, g, b, a);
1175-
} catch (const runtime_error& e) {
1175+
} catch (const out_of_range& e) {
11761176
break;
11771177
}
11781178
}
@@ -1223,7 +1223,7 @@ void Image::draw_text_v(ssize_t x, ssize_t y, ssize_t* width, ssize_t* height,
12231223
}
12241224
try {
12251225
this->write_pixel(x_pos + xx, y_pos + yy, r, g, b, a);
1226-
} catch (const runtime_error& e) {
1226+
} catch (const out_of_range& e) {
12271227
}
12281228
}
12291229
}
@@ -1338,7 +1338,7 @@ void Image::fill_rect(ssize_t x, ssize_t y, ssize_t w, ssize_t h, uint64_t r,
13381338
for (ssize_t xx = 0; xx < w; xx++) {
13391339
try {
13401340
this->write_pixel(x + xx, y + yy, r, g, b, a);
1341-
} catch (const runtime_error& e) {
1341+
} catch (const out_of_range& e) {
13421342
}
13431343
}
13441344
}
@@ -1353,7 +1353,7 @@ void Image::fill_rect(ssize_t x, ssize_t y, ssize_t w, ssize_t h, uint64_t r,
13531353
_b = (a * (uint32_t)b + (0xFF - a) * (uint32_t)_b) / 0xFF;
13541354
_a = (a * (uint32_t)a + (0xFF - a) * (uint32_t)_a) / 0xFF;
13551355
this->write_pixel(x + xx, y + yy, _r, _g, _b, _a);
1356-
} catch (const runtime_error& e) {
1356+
} catch (const out_of_range& e) {
13571357
}
13581358
}
13591359
}

0 commit comments

Comments
 (0)