core/playlist: Don't calculate an average if count is zero
This fixes a divide-by-zero segfault. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
1cd22a9454
commit
5b5b7ebea6
|
@ -43,7 +43,10 @@ public:
|
|||
count++;
|
||||
}
|
||||
}
|
||||
return total / count;
|
||||
|
||||
if (count > 0)
|
||||
return total / count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dynamic_add(const std::string &name, Track *track, unsigned int avg)
|
||||
|
|
Loading…
Reference in New Issue
Block a user