capmt: avoid use cam after delete

(re-add this commit; was removed by mistake)


Origin commit data
------------------
Commit: 1f3af481c8
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-05-09 (Thu, 09 May 2019)
This commit is contained in:
Jacek Jendrzej
2019-05-09 15:57:15 +02:00
committed by vanhofen
parent f8d1b0114a
commit 1bb0456905

View File

@@ -296,7 +296,7 @@ bool CCamManager::SetMode(t_channel_id channel_id, enum runmode mode, bool start
cam->sendMessage(NULL, 0, false); cam->sendMessage(NULL, 0, false);
/* clean up channel_map with stopped record/stream/pip services NOT live-tv */ /* clean up channel_map with stopped record/stream/pip services NOT live-tv */
it = channel_map.find(channel_id); it = channel_map.find(channel_id);
if(it != channel_map.end() && newmask != 0) if(it != channel_map.end() && newmask != 0 && it->second != cam)
{ {
delete it->second; delete it->second;
channel_map.erase(channel_id); channel_map.erase(channel_id);