mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
prevent crash in crop_image function
This commit is contained in:
@@ -460,7 +460,9 @@ Image InsertedImage::generate(const Options& opt) {
|
||||
int inserted_x = offset_x < 0 ? 0 : offset_x;
|
||||
int inserted_y = offset_y < 0 ? 0 : offset_y;
|
||||
int width = max(base_x + base_img.GetWidth(), inserted_x + inserted_img.GetWidth());
|
||||
int height = max(base_y + base_img.GetHeight(), inserted_y + inserted_img.GetHeight());
|
||||
int height = max(base_y + base_img.GetHeight(), inserted_y + inserted_img.GetHeight());
|
||||
if (width <= 0) throw ScriptError(_ERROR_1_("negative image width", "insert_image"));
|
||||
if (height <= 0) throw ScriptError(_ERROR_1_("negative image height", "insert_image"));
|
||||
UInt size = width * height;
|
||||
Image img = wxImage(width, height, false);
|
||||
img.InitAlpha();
|
||||
@@ -496,7 +498,9 @@ bool InsertedImage::operator == (const GeneratedImage& that) const {
|
||||
|
||||
// ----------------------------------------------------------------------------- : CropImage
|
||||
|
||||
Image CropImage::generate(const Options& opt) {
|
||||
Image CropImage::generate(const Options& opt) {
|
||||
if (width <= 0) throw ScriptError(_ERROR_1_("negative image width", "crop_image"));
|
||||
if (height <= 0) throw ScriptError(_ERROR_1_("negative image height", "crop_image"));
|
||||
UInt size = width * height;
|
||||
Image img = wxImage(width, height, false);
|
||||
img.InitAlpha();
|
||||
|
||||
Reference in New Issue
Block a user