I am reposting as I see some people upset about the last episode. Here's a full summary of the end from the book and it's a very happy one!
In the novel, XH goes to war and disappears and this happens shortly after SYR dies. He did not get married yet (they changed that in the drama). Everyone said he died in battle and his jade was returned to XFF. XFF waited for him despite everyone saying he died. She took care of the Su Manor and Ye ShiJie stayed by her side the whole time. A long time passed, and XFF couldn't move on. She decided to go to Qilin where XH reportedly was killed in battle to try to find his body., but it was reported his body couldn't be returned and was eaten by wolves. The army at the time had already returned to the capital and were victorious but XH never returned. XFF made her journey to Qilin and somewhere along the way, she and XH reunite!!!!! Ends up XH was actually badly injured and was blinded. The emperor didn't want him to reveal he was alive because he wanted all the rebels to reveal themselves. Also XH was very weak and if people knew he was alive, his life would be at risk. He learned to live amongst the commoners. He wanted to tell XFF he was alive and even went to visit her secretly but the emperor didn't trust XFF since she knew too much. He told XH, if XFF doesn't end up remarrying after a year, they can reunite....something like that. XH also felt he wasn't good enough for XFF at this point given he was blinded. The emperor agreed to cure his eyes but he wanted to see what XFF would do while she mourned for XH's death. If she remarries, she will have her killed since she knows too much. In the novel, the emperor has grown to be distrustful. When he returns, they are granted a marriage. So what we see in 40.5 happens after he goes missing and returns.
As a side tidbit, XH prepared all the dowry before he went to war and even embroidered the jewels himself on XFF's wedding gown. So sweet! After they got married, XH loved XFF very much and it's almost like his world revolved only around her. Whatever she loved, he loved. There was a sweet part where he goes early to line up for red bean cakes just like the commoners instead of asking the servants. He enjoyed doing everyday trivial things as he never had the chance to do that in the past. He also took XFF traveling as she hoped to see the world. They were a super sweet couple and XFF comments she never would have imagined she would meet someone who would love her as much as XH <3