chansrv: dvc, check channel exists on get/remove api struct

master
speidy 8 years ago committed by Idan Freiberg
parent 6ed4c969f4
commit cfdbc2b4db

@ -1670,7 +1670,8 @@ struct_from_dvc_chan_id(tui32 dvc_chan_id)
for (i = 0; i < MAX_DVC_CHANNELS; i++)
{
if (g_dvc_channels[i]->dvc_chan_id >= 0 &&
if (g_dvc_channels[i] != NULL &&
g_dvc_channels[i]->dvc_chan_id >= 0 &&
(tui32) g_dvc_channels[i]->dvc_chan_id == dvc_chan_id)
{
return g_dvc_channels[i];
@ -1687,7 +1688,8 @@ remove_struct_with_chan_id(tui32 dvc_chan_id)
for (i = 0; i < MAX_DVC_CHANNELS; i++)
{
if (g_dvc_channels[i]->dvc_chan_id >= 0 &&
if (g_dvc_channels[i] != NULL &&
g_dvc_channels[i]->dvc_chan_id >= 0 &&
(tui32) g_dvc_channels[i]->dvc_chan_id == dvc_chan_id)
{
g_dvc_channels[i] = NULL;

Loading…
Cancel
Save