China would take the opportunity to step up on the world stage.
They would invade North Korea themselves, claim they are doing for the UN, then rebuild North Korea again and put someone in power who is under their control.
China does not consider North Korea to one of their greatest allies. Yes they exploit North Korea's shinanigans, partly to keep control of the situation and partly to edge out US influence in the region. They actually have a lot of issues with North Korea; border issues, refugee issues, political issues. China wants North Korea there because they like the buffer between them and South Korea. It also gives them a buffer on a historical avenue of invasion into China. Overall, China wants the status quo to be maintained.
By invading North Korea, they get to claim responsibility for ending a conflict. They win favor with South Korea and possibly Japan. They get to look like the good guys on the world stage. They win influence at the UN. They make sure North Korea does not unite with South Korea.
Overall, China does not want war. They especially do not want it in Korea on their doorstep.
On the other hand, if it was South Korea or the US that attacked North Korea (it would never happen, but if it did), then China would support North Korea.