diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index 19bbad1b8..fc338675b 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -551,6 +551,11 @@ int CGraphics_Threaded::LoadPNG(CImageInfo *pImg, const char *pFilename, int Sto pImg->m_Format = CImageInfo::FORMAT_RGB; else if(Png.color_type == PNG_TRUECOLOR_ALPHA) // ignore_convention pImg->m_Format = CImageInfo::FORMAT_RGBA; + else + { + free(pBuffer); + return 0; + } pImg->m_pData = pBuffer; return 1; } diff --git a/src/game/client/components/countryflags.cpp b/src/game/client/components/countryflags.cpp index 7776f94b3..33e114720 100644 --- a/src/game/client/components/countryflags.cpp +++ b/src/game/client/components/countryflags.cpp @@ -58,7 +58,8 @@ void CCountryFlags::LoadCountryflagsIndexfile() // load the graphic file char aBuf[128]; CImageInfo Info; - if(g_Config.m_ClLoadCountryFlags) + bool LoadCountryFlags = g_Config.m_ClLoadCountryFlags; + if(LoadCountryFlags) { str_format(aBuf, sizeof(aBuf), "countryflags/%s.png", aOrigin); if(!Graphics()->LoadPNG(&Info, aBuf, IStorage::TYPE_ALL)) @@ -74,7 +75,7 @@ void CCountryFlags::LoadCountryflagsIndexfile() CCountryFlag CountryFlag; CountryFlag.m_CountryCode = CountryCode; str_copy(CountryFlag.m_aCountryCodeString, aOrigin, sizeof(CountryFlag.m_aCountryCodeString)); - if(g_Config.m_ClLoadCountryFlags) + if(LoadCountryFlags) { CountryFlag.m_Texture = Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0); free(Info.m_pData); diff --git a/src/game/client/prediction/entities/laser.cpp b/src/game/client/prediction/entities/laser.cpp index b910835b5..3f96aaedf 100644 --- a/src/game/client/prediction/entities/laser.cpp +++ b/src/game/client/prediction/entities/laser.cpp @@ -48,10 +48,10 @@ bool CLaser::HitCharacter(vec2 From, vec2 To) float Strength = GetTuning(m_TuneZone)->m_ShotgunStrength; - if(!g_Config.m_SvOldLaser) - Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength; - else + if(g_Config.m_SvOldLaser && pOwnerChar) Temp = pHit->Core()->m_Vel + normalize(pOwnerChar->Core()->m_Pos - pHit->Core()->m_Pos) * Strength; + else + Temp = pHit->Core()->m_Vel + normalize(m_PrevPos - pHit->Core()->m_Pos) * Strength; pHit->Core()->m_Vel = ClampVel(pHit->m_MoveRestrictions, Temp); } else if(m_Type == WEAPON_LASER) diff --git a/src/game/editor/auto_map.cpp b/src/game/editor/auto_map.cpp index 7b1c9f1e0..7e77ad179 100644 --- a/src/game/editor/auto_map.cpp +++ b/src/game/editor/auto_map.cpp @@ -86,7 +86,7 @@ void CAutoMapper::Load(const char *pTileName) int RunID = pCurrentConf->m_aRuns.add(NewRun); pCurrentRun = &pCurrentConf->m_aRuns[RunID]; } - else if(str_startswith(pLine, "NewRun")) + else if(str_startswith(pLine, "NewRun") && pCurrentConf) { // add new run CRun NewRun;