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
@@ -183,10 +183,13 @@ void weak_function nxsched_process_cpuload(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < g_npidhash; i++)
|
for (i = 0; i < g_npidhash; i++)
|
||||||
|
{
|
||||||
|
if (g_pidhash[i])
|
||||||
{
|
{
|
||||||
g_pidhash[i]->ticks >>= 1;
|
g_pidhash[i]->ticks >>= 1;
|
||||||
total += g_pidhash[i]->ticks;
|
total += g_pidhash[i]->ticks;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Save the new total. */
|
/* Save the new total. */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user