make alert_cast<> support 0

This commit is contained in:
Arvid Norberg 2011-01-24 18:20:41 +00:00
parent 9964b9cdb6
commit 41806e2e07
1 changed files with 2 additions and 0 deletions

View File

@ -219,6 +219,7 @@ namespace libtorrent {
template <class T>
T* alert_cast(alert* a)
{
if (a == 0) return 0;
if (a->type() == T::alert_type) return static_cast<T*>(a);
return 0;
}
@ -226,6 +227,7 @@ T* alert_cast(alert* a)
template <class T>
T const* alert_cast(alert const* a)
{
if (a == 0) return 0;
if (a->type() == T::alert_type) return static_cast<T const*>(a);
return 0;
}