Don't divide by zero when size of parent dir = 0
It's a floating point division, so won't really cause any real problems on most systems. Still, a percentage of 'nan' isn't really useful.
Этот коммит содержится в:
родитель
95b314de73
Коммит
0fe0d11e3b
@ -185,7 +185,9 @@ void browse_draw_item(struct dir *n, int row, off_t max, int ispar) {
|
|||||||
size = formatsize(flags & BF_AS ? n->asize : n->size);
|
size = formatsize(flags & BF_AS ? n->asize : n->size);
|
||||||
|
|
||||||
/* create graph (if necessary) */
|
/* create graph (if necessary) */
|
||||||
pc = ((float)(flags & BF_AS ? n->asize : n->size) / (float)(flags & BF_AS ? n->parent->asize : n->parent->size)) * 100.0f;
|
if((pc = (float)(flags & BF_AS ? n->parent->asize : n->parent->size)) < 1)
|
||||||
|
pc = 1.0f;
|
||||||
|
pc = ((float)(flags & BF_AS ? n->asize : n->size) / pc) * 100.0f;
|
||||||
if(graph == 1 || graph == 3) {
|
if(graph == 1 || graph == 3) {
|
||||||
o = (int)(10.0f*(float)(flags & BF_AS ? n->asize : n->size) / (float)max);
|
o = (int)(10.0f*(float)(flags & BF_AS ? n->asize : n->size) / (float)max);
|
||||||
for(i=0; i<10; i++)
|
for(i=0; i<10; i++)
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user