提交 f0c76fab authored 作者: Seven Du's avatar Seven Du

FS-8811 fix divide by 0

上级 b80eb983
...@@ -183,6 +183,8 @@ static int do_rand(uint32_t count) ...@@ -183,6 +183,8 @@ static int do_rand(uint32_t count)
{ {
int r = 0; int r = 0;
if (count == 0) return 0;
switch_mutex_lock(globals.mutex); switch_mutex_lock(globals.mutex);
r = (rand() % count) + 1; r = (rand() % count) + 1;
switch_mutex_unlock(globals.mutex); switch_mutex_unlock(globals.mutex);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论