链表的冒泡排序中出现的问题?

为啥调试过程中显示be指针为空指针呀?
void sort(ST head)
{
ST onset; ST com; ST be;
ST t = NULL;
while(head->next != t)
{
onset = head;
com = onset->next;
be = com->next;
while (com->next != t)
{
if (be->num > com->num)
{
onset->next = com;
be->next = com->next;
com->next = be;

        }
        else
        {
            ST t = be;
            be = com;
            com = t;
        }
        be = be->next;
        com = com->next;
        onset = onset->next;
        
    }
    t = com;
}return;

}