Fix copy status 0 division

This commit is contained in:
2023-07-31 17:17:09 +02:00
parent bc31b71130
commit ed0abd9b6a

View File

@@ -45,7 +45,11 @@ public class CopyCommand : CommandBase, ITransportationCommand
.Select(p =>
{
if (p is null) return Observable.Never<int>();
return p.Progress.Select(currentProgress => (int) (currentProgress * 100 / p.TotalCount));
return p.Progress.Select(currentProgress =>
p.TotalCount == 0
? 0
: (int) (currentProgress * 100 / p.TotalCount)
);
})
.Switch()
.Subscribe(SetCurrentProgress);