diff --git a/source/glest_game/game/script_manager.cpp b/source/glest_game/game/script_manager.cpp index 558dfe2c4..8a3b4fcd8 100644 --- a/source/glest_game/game/script_manager.cpp +++ b/source/glest_game/game/script_manager.cpp @@ -1033,8 +1033,11 @@ void ScriptManager::shakeCamera(int shakeIntensity, int shakeDuration, bool came if (cameraDistanceAffected) { Unit *unit = world->findUnitById(unitId); - gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrMidHeightVector()); - } else { + if(unit) { + gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrMidHeightVector()); + } + } + else { gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, Vec3f(0.f,0.f,0.f)); } } @@ -1542,7 +1545,12 @@ int ScriptManager::getUnitFaction(int unitId) { const string ScriptManager::getUnitName(int unitId) { if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - return world->findUnitById(unitId)->getType()->getName(false); + string result = ""; + Unit *unit = world->findUnitById(unitId); + if(unit) { + result = world->findUnitById(unitId)->getType()->getName(false); + } + return result; } const string ScriptManager::getUnitDisplayName(int unitId) { diff --git a/source/glest_game/types/skill_type.cpp b/source/glest_game/types/skill_type.cpp index 57db9210f..0927c9cab 100644 --- a/source/glest_game/types/skill_type.cpp +++ b/source/glest_game/types/skill_type.cpp @@ -945,16 +945,16 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, projectile= projectileNode->getAttribute("value")->getBoolValue(); if(projectile){ // create new projectile - ProjectileType *projectileType=new ProjectileType(); - //only add this projectile if there is an enabled particlesystem - //projectileTypes.push_back(projectileType); - projectileType->setAttackStartTime(attackStartTime); - projectileType->setDamagePercentage(100); + ProjectileType *projectileType = new ProjectileType(); + //only add this projectile if there is an enabled particlesystem + //projectileTypes.push_back(projectileType); + projectileType->setAttackStartTime(attackStartTime); + projectileType->setDamagePercentage(100); //proj particle if(projectileNode->hasChild("particle")){ const XmlNode *particleNode= projectileNode->getChild("particle"); bool particleEnabled= particleNode->getAttribute("value")->getBoolValue(); - if(particleEnabled){ + if(particleEnabled) { projectileTypes.push_back(projectileType); string path= particleNode->getAttribute("path")->getRestrictedValue(); ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile(); @@ -968,6 +968,9 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, delete projectileType; } } + else { + delete projectileType; + } //proj sounds const XmlNode *soundNode= projectileNode->getChild("sound"); if(soundNode->getAttribute("enabled")->getBoolValue()){ diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index 514a58ea8..d884e7f1f 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -2676,10 +2676,10 @@ int UPNP_Tools::upnp_init(void *param) { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"No UPnP devices found.\n"); if(ServerSocket::cancelUpnpdiscoverThread == true) { - if(devlist != NULL) { - freeUPNPDevlist(devlist); - } - devlist = NULL; + //if(devlist != NULL) { + // freeUPNPDevlist(devlist); + //} + //devlist = NULL; return result; }