src/fcint.h (FcCacheBankToIndex);

Fix segfault by guarding array dereference.
This commit is contained in:
Patrick Lam 2005-11-29 15:04:06 +00:00
parent b8948e8542
commit 93a27747a4
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-11-29 Patrick Lam <plam@mit.edu>
* src/fcint.h (FcCacheBankToIndex);
Fix segfault by guarding array dereference.
2005-11-29 Dirk Mueller <dmueller@suse.de> 2005-11-29 Dirk Mueller <dmueller@suse.de>
reviewed by: plam reviewed by: plam

View File

@ -469,7 +469,7 @@ FcCacheBankToIndexMTF (int bank);
static __inline__ int static __inline__ int
FcCacheBankToIndex (int bank) FcCacheBankToIndex (int bank)
{ {
return _fcBankId[*_fcBankIdx] == bank ? *_fcBankIdx : FcCacheBankToIndexMTF(bank); return (_fcBankId && _fcBankId[*_fcBankIdx] == bank) ? *_fcBankIdx : FcCacheBankToIndexMTF(bank);
} }
const char * const char *