Memory usage division by zero

The showAllConcise with division by zero error.

Change-Id: I469f1b9f268842cd51662be6f9036f555a8949b2
This commit is contained in:
Bill(Shuzhou) Liu
2023-02-24 08:38:18 -06:00
parent b40933b895
commit 55bc2e2072
+1 -1
View File
@@ -1539,7 +1539,7 @@ def showAllConcise(deviceList):
else:
gpu_busy = 'Unsupported'
memInfo = getMemInfo(device, 'vram')
if memInfo[0] == None or memInfo[1] == None:
if memInfo[0] == None or memInfo[1] == None or float(memInfo[1]) == 0:
mem_use = 'N/A'
else:
mem_use_pct = '% 3.0f%%' % (100 * (float(memInfo[0]) / float(memInfo[1])))