gui/infoviewer.cpp: fix crash, if s.f_blocks is 0

happens if network_nfs_recordingdir set to not mounted dir under tmp or media


Origin commit data
------------------
Branch: ni/coolstream
Commit: 36b80096b9
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-19 (Thu, 19 Apr 2012)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2012-04-19 18:26:47 +04:00
parent abc49c687e
commit 104398b293

View File

@@ -1628,8 +1628,9 @@ void CInfoViewer::showSNR ()
per = 0;
//HD info
if(!check_dir(g_settings.network_nfs_recordingdir)) {
if (::statfs(g_settings.network_nfs_recordingdir, &s) == 0) {
per = (s.f_blocks - s.f_bfree) / (s.f_blocks/100);
if (::statfs(g_settings.network_nfs_recordingdir, &s) == 0 && s.f_blocks) {
long blocks_used = s.f_blocks - s.f_bfree;
per = (blocks_used * 100ULL) / s.f_blocks;
}
}
hddscale->paintProgressBar(scale_x, BBarY + InfoHeightY_Info / 2 + 2, hddwidth, 6, per, 100);