diff options
author | Scott Michel <scottm@aero.org> | 2008-11-22 23:49:26 +0000 |
---|---|---|
committer | Scott Michel <scottm@aero.org> | 2008-11-22 23:49:26 +0000 |
commit | bab6436b1726a2db21ab1e024540e98c02a5a009 (patch) | |
tree | 4c800bed4de2bc27e0980d9eb8bcbf2f0751a89a /include/llvm/Support/Casting.h | |
parent | 7a1527389265ad5444ac1a4a3dd8901c2f20e902 (diff) | |
download | llvm-bab6436b1726a2db21ab1e024540e98c02a5a009.tar.gz llvm-bab6436b1726a2db21ab1e024540e98c02a5a009.tar.bz2 llvm-bab6436b1726a2db21ab1e024540e98c02a5a009.tar.xz |
Check for NULL before traversing the isa<> type hierarchy checking with a
NULL-based reference.
Note: Encountered this a few times on Tiger + gcc 4.0.1. Might just be a
platform-specific compiler issue, but it's good defensive programming in any
case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59890 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/Casting.h')
-rw-r--r-- | include/llvm/Support/Casting.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h index 48988f8a6b..c441626216 100644 --- a/include/llvm/Support/Casting.h +++ b/include/llvm/Support/Casting.h @@ -98,7 +98,7 @@ template<class FromCl> struct isa_impl_cl<FromCl*> { template<class ToCl> static bool isa(FromCl *Val) { - return isa_impl_cl<FromCl>::template isa<ToCl>(*Val); + return (Val != 0 && isa_impl_cl<FromCl>::template isa<ToCl>(*Val)); } }; |