make alert_cast<> support 0
This commit is contained in:
parent
9964b9cdb6
commit
41806e2e07
|
@ -219,6 +219,7 @@ namespace libtorrent {
|
||||||
template <class T>
|
template <class T>
|
||||||
T* alert_cast(alert* a)
|
T* alert_cast(alert* a)
|
||||||
{
|
{
|
||||||
|
if (a == 0) return 0;
|
||||||
if (a->type() == T::alert_type) return static_cast<T*>(a);
|
if (a->type() == T::alert_type) return static_cast<T*>(a);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -226,6 +227,7 @@ T* alert_cast(alert* a)
|
||||||
template <class T>
|
template <class T>
|
||||||
T const* alert_cast(alert const* a)
|
T const* alert_cast(alert const* a)
|
||||||
{
|
{
|
||||||
|
if (a == 0) return 0;
|
||||||
if (a->type() == T::alert_type) return static_cast<T const*>(a);
|
if (a->type() == T::alert_type) return static_cast<T const*>(a);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue