core/metrics: prevent division by zero
This commit is contained in:
parent
c8731eaa2c
commit
41ef7ca17c
@ -30,8 +30,10 @@ double metrics_write_bytes(rdpMetrics* metrics, UINT32 UncompressedBytes, UINT32
|
|||||||
metrics->TotalUncompressedBytes += UncompressedBytes;
|
metrics->TotalUncompressedBytes += UncompressedBytes;
|
||||||
metrics->TotalCompressedBytes += CompressedBytes;
|
metrics->TotalCompressedBytes += CompressedBytes;
|
||||||
|
|
||||||
CompressionRatio = ((double) CompressedBytes) / ((double) UncompressedBytes);
|
if (UncompressedBytes != 0)
|
||||||
metrics->TotalCompressionRatio = ((double) metrics->TotalCompressedBytes) / ((double) metrics->TotalUncompressedBytes);
|
CompressionRatio = ((double) CompressedBytes) / ((double) UncompressedBytes);
|
||||||
|
if (metrics->TotalUncompressedBytes != 0)
|
||||||
|
metrics->TotalCompressionRatio = ((double) metrics->TotalCompressedBytes) / ((double) metrics->TotalUncompressedBytes);
|
||||||
|
|
||||||
return CompressionRatio;
|
return CompressionRatio;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user