- added null checks for group selection
This commit is contained in:
parent
719029358f
commit
cb456840cd
|
@ -1 +1 @@
|
||||||
Subproject commit 736113a2b4b883722279942e11e63bdb414fe39f
|
Subproject commit bf04854ade7cd0fc51483c857e590acfef4fbc26
|
|
@ -853,8 +853,27 @@ void Gui::computeDisplay(){
|
||||||
}
|
}
|
||||||
|
|
||||||
//portraits
|
//portraits
|
||||||
for(int i= 0; i < selection.getCount(); ++i){
|
int unitIndex = 0;
|
||||||
display.setUpImage(i, selection.getUnit(i)->getType()->getImage());
|
for(unitIndex = 0; unitIndex < selection.getCount(); ++unitIndex){
|
||||||
|
try {
|
||||||
|
const Unit *unit = selection.getUnit(unitIndex);
|
||||||
|
if(unit == NULL) {
|
||||||
|
throw megaglest_runtime_error("unit == NULL");
|
||||||
|
}
|
||||||
|
if(unit->getType() == NULL) {
|
||||||
|
throw megaglest_runtime_error("unit->getType() == NULL");
|
||||||
|
}
|
||||||
|
if(unit->getType()->getImage() == NULL) {
|
||||||
|
throw megaglest_runtime_error("unit->getType()->getImage()");
|
||||||
|
}
|
||||||
|
|
||||||
|
display.setUpImage(unitIndex, unit->getType()->getImage());
|
||||||
|
}
|
||||||
|
catch(exception &ex) {
|
||||||
|
char szBuf[8096]="";
|
||||||
|
snprintf(szBuf,8096,"Error in unit selection for index: %d error [%s]",unitIndex,ex.what());
|
||||||
|
throw megaglest_runtime_error(szBuf, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================ PART 2 ================
|
// ================ PART 2 ================
|
||||||
|
|
Loading…
Reference in New Issue