From 41806e2e07726604538e58e9960326c4c0a0bf14 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 24 Jan 2011 18:20:41 +0000 Subject: [PATCH] make alert_cast<> support 0 --- include/libtorrent/alert.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libtorrent/alert.hpp b/include/libtorrent/alert.hpp index f51c31c10..c0a57ff80 100644 --- a/include/libtorrent/alert.hpp +++ b/include/libtorrent/alert.hpp @@ -219,6 +219,7 @@ namespace libtorrent { template T* alert_cast(alert* a) { + if (a == 0) return 0; if (a->type() == T::alert_type) return static_cast(a); return 0; } @@ -226,6 +227,7 @@ T* alert_cast(alert* a) template T const* alert_cast(alert const* a) { + if (a == 0) return 0; if (a->type() == T::alert_type) return static_cast(a); return 0; }