don't show progress percent when the file size is 0

Thu, 08 Feb 2024 10:24:20 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 08 Feb 2024 10:24:20 +0100
changeset 22
d7942163a2a3
parent 21
3060a5a1d5fd
child 23
cdcb20412dd4

don't show progress percent when the file size is 0

application/davcontroller.c file | annotate | diff | comparison | revisions
--- a/application/davcontroller.c	Thu Feb 08 10:22:58 2024 +0100
+++ b/application/davcontroller.c	Thu Feb 08 10:24:20 2024 +0100
@@ -301,11 +301,11 @@
     free(sz_total);
     free(label1.ptr);
 
-
-    cxmutstr file_label = cx_asprintf("%s (%.0f%%)", upload->current_file_name, ((float)upload->current_file_upload/(float)upload->current_file_size)*100);
-    ui_set(upload->label_top_right, file_label.ptr);
-
-    free(file_label.ptr);
+    if (upload->current_file_size > 0) {
+        cxmutstr file_label = cx_asprintf("%s (%.0f%%)", upload->current_file_name, ((float)upload->current_file_upload/(float)upload->current_file_size)*100);
+        ui_set(upload->label_top_right, file_label.ptr);
+        free(file_label.ptr);
+    }
 }
 
 static int uithr_update_upload_labels(void *data) {

mercurial