Permalink
Browse files

BAMFontManager::GetFont: don't use out-of-scope variables

fixes coverity 4458
  • Loading branch information...
1 parent 15ca13d commit 23a35b0a03d8c33a965a4856dc3739d9fb24de5b @lynxlynxlynx lynxlynxlynx committed Apr 17, 2013
Showing with 5 additions and 4 deletions.
  1. +5 −4 gemrb/plugins/BAMImporter/BAMFontManager.cpp
@@ -54,19 +54,20 @@ Font* BAMFontManager::GetFont(unsigned short /*ptSize*/,
{
AnimationFactory* af = bamImp->GetAnimationFactory(resRef); // released by BAMFont
- int* baseline = NULL;
+ Font* fnt = NULL;
if (isStateFont) {
// Hack to work around original data where some status icons have inverted x and y positions (ie level up icon)
// isStateFont is set in Open() and simply compares the first 6 characters of the file with "STATES"
// since state icons should all be the same size/position we can just take the position of the first one
Sprite2D* first = af->GetFrame(0, 0);
- int pos = first->YPos;
- baseline = &pos;
+ int pos = first->YPos; // baseline
first->release();
+ fnt = new BAMFont(af, &pos);
+ } else {
+ fnt = new BAMFont(af, NULL);
}
- Font* fnt = new BAMFont(af, baseline);
if (!fnt) {
delete af;
return NULL;

0 comments on commit 23a35b0

Please sign in to comment.