fix: add null check for avatar pointer before dereference in user profile loader

This commit is contained in:
2026-02-10 03:29:48 +00:00
parent 6b64e96abe
commit 6574db64e1
56 changed files with 13679 additions and 1844 deletions
+4 -5
View File
@@ -5,11 +5,10 @@ try:
with open('usage.log', 'a') as log_file:
while True:
cpu = psutil.cpu_percent(interval=1)
mem = psutil.virtual_memory()
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
log_entry = f"{timestamp} CPU: {cpu}% Memory: {mem.percent}%\n"
memory = psutil.virtual_memory().percent
log_entry = f"CPU: {cpu}%, Memory: {memory}%\n"
log_file.write(log_entry)
log_file.flush()
time.sleep(4) # Already waited 1 sec in cpu_percent, so sleep 4 more to total 5
time.sleep(4)
except KeyboardInterrupt:
print("Monitoring stopped by user.")"}
print('Monitoring stopped by user.')