浏览代码

Fix crash related to zeros stored in settings

nordsoft 2 年之前
父节点
当前提交
522cb00edd
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      mapeditor/windownewmap.cpp

+ 4 - 2
mapeditor/windownewmap.cpp

@@ -37,8 +37,10 @@ WindowNewMap::WindowNewMap(QWidget *parent) :
 	show();
 
 	//setup initial parameters
-	mapGenOptions.setWidth(ui->widthTxt->text().toInt());
-	mapGenOptions.setHeight(ui->heightTxt->text().toInt());
+	int width = ui->widthTxt->text().toInt();
+	int height = ui->heightTxt->text().toInt();
+	mapGenOptions.setWidth(width ? width : 1);
+	mapGenOptions.setHeight(height ? height : 1);
 	bool twoLevel = ui->twoLevelCheck->isChecked();
 	mapGenOptions.setHasTwoLevels(twoLevel);
 	updateTemplateList();