GUIで入力された変数の制約条件チェックを強化

This commit is contained in:
lltcggie 2015-06-03 04:33:41 +09:00
parent 57fbdf4225
commit 31b70fe277

View File

@ -147,7 +147,7 @@ private:
char *ptr = nullptr; char *ptr = nullptr;
scale_ratio = strtod(buf, &ptr); scale_ratio = strtod(buf, &ptr);
if (!ptr || *ptr != '\0') if (!ptr || *ptr != '\0' || scale_ratio <= 0.0)
{ {
scale_ratio = 2.0; scale_ratio = 2.0;
ret = false; ret = false;
@ -186,7 +186,7 @@ private:
char *ptr = nullptr; char *ptr = nullptr;
crop_size = strtol (buf, &ptr, 10); crop_size = strtol (buf, &ptr, 10);
if (!ptr || *ptr != '\0') if (!ptr || *ptr != '\0' || crop_size <= 0)
{ {
crop_size = 128; crop_size = 128;
ret = false; ret = false;