summaryrefslogtreecommitdiff
path: root/src/gui/charcreatedialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-04 21:11:28 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-04 21:11:28 +0300
commit8dd47e51d9c318e522b21f28bc3e3935ef692056 (patch)
tree30b364f3f1b04fd31efec47332d193567894997f /src/gui/charcreatedialog.cpp
parentd1d205fbe0c2d63bbd08742c56f00852ccc0523b (diff)
downloadmv-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.gz
mv-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.bz2
mv-8dd47e51d9c318e522b21f28bc3e3935ef692056.tar.xz
mv-8dd47e51d9c318e522b21f28bc3e3935ef692056.zip
add missing checks.
also fix crash in creating character with broken data.
Diffstat (limited to 'src/gui/charcreatedialog.cpp')
-rw-r--r--src/gui/charcreatedialog.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index c32098b63..b0a7d730c 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -159,8 +159,14 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
if (!maxHairStyle)
maxHairStyle = mPlayer->getNumOfHairstyles();
- mHairStyle = (rand() % maxHairStyle) + minHairStyle;
- mHairColor = (rand() % maxHairColor) + minHairColor;
+ if (maxHairStyle)
+ mHairStyle = (rand() % maxHairStyle) + minHairStyle;
+ else
+ mHairStyle = 0;
+ if (maxHairColor)
+ mHairColor = (rand() % maxHairColor) + minHairColor;
+ else
+ mHairColor = 0;
mNameField->setMaximum(24);