mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
cpuload: fix crash because of the member of g_pidhash is NULL
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
committed by
Alin Jerpelea
parent
3e1ce5f770
commit
7e59a6a31e
@@ -184,8 +184,11 @@ void weak_function nxsched_process_cpuload(void)
|
||||
|
||||
for (i = 0; i < g_npidhash; i++)
|
||||
{
|
||||
g_pidhash[i]->ticks >>= 1;
|
||||
total += g_pidhash[i]->ticks;
|
||||
if (g_pidhash[i])
|
||||
{
|
||||
g_pidhash[i]->ticks >>= 1;
|
||||
total += g_pidhash[i]->ticks;
|
||||
}
|
||||
}
|
||||
|
||||
/* Save the new total. */
|
||||
|
||||
Reference in New Issue
Block a user