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:
Anna Schumaker 2015-12-02 15:25:34 -05:00
parent 1cd22a9454
commit 5b5b7ebea6
1 changed files with 4 additions and 1 deletions

View File

@ -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)