This commit is contained in:
nicolargo 2025-04-13 16:36:29 +02:00
parent 941baba5b4
commit a550afbd25
1 changed files with 2 additions and 2 deletions

View File

@ -300,11 +300,11 @@ class PluginModel(GlancesPluginModel):
to_bit = 8
unit = 'b'
if args.network_cumul and 'bytes_recv' in i and 'bytes_sent' in i:
if args.network_cumul and i.get('bytes_recv') is not None and i.get('bytes_sent') is not None:
rx = self.auto_unit(int(i['bytes_recv'] * to_bit)) + unit
tx = self.auto_unit(int(i['bytes_sent'] * to_bit)) + unit
ax = self.auto_unit(int(i['bytes_all'] * to_bit)) + unit
elif 'bytes_recv_rate_per_sec' in i and 'bytes_sent_rate_per_sec' in i:
elif i.get('bytes_recv_rate_per_sec') is not None and i.get('bytes_sent_rate_per_sec') is not None:
rx = self.auto_unit(int(i['bytes_recv_rate_per_sec'] * to_bit)) + unit
tx = self.auto_unit(int(i['bytes_sent_rate_per_sec'] * to_bit)) + unit
ax = self.auto_unit(int(i['bytes_all_rate_per_sec'] * to_bit)) + unit