task_queue_put - prevent dereference of null pointer
This commit is contained in:
parent
bc61ceb338
commit
28399641da
|
@ -115,10 +115,15 @@ static void task_queue_put(task_queue_t *queue, retro_task_t *task)
|
||||||
|
|
||||||
if (queue->front)
|
if (queue->front)
|
||||||
{
|
{
|
||||||
/* Make sure to insert in order - the queue is sorted by 'when' so items that aren't scheduled
|
/* Make sure to insert in order - the queue is
|
||||||
* to run immediately are at the back of the queue. Items with the same 'when' are inserted after
|
* sorted by 'when' so items that aren't scheduled
|
||||||
* all the other items with the same 'when'. This primarily affects items with a 'when' of 0.
|
* to run immediately are at the back of the queue.
|
||||||
|
* Items with the same 'when' are inserted after
|
||||||
|
* all the other items with the same 'when'.
|
||||||
|
* This primarily affects items with a 'when' of 0.
|
||||||
*/
|
*/
|
||||||
|
if (queue->back)
|
||||||
|
{
|
||||||
if (queue->back->when > task->when)
|
if (queue->back->when > task->when)
|
||||||
{
|
{
|
||||||
retro_task_t** prev = &queue->front;
|
retro_task_t** prev = &queue->front;
|
||||||
|
@ -132,6 +137,7 @@ static void task_queue_put(task_queue_t *queue, retro_task_t *task)
|
||||||
|
|
||||||
queue->back->next = task;
|
queue->back->next = task;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
queue->front = task;
|
queue->front = task;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue