I guess you are making the simple thing a bit more complex. If you ara using shortlink as well as long link deleting a node becomes a large process.
As you mentioned in the example
"3 points to 4 (shortlink) and 6 (longlink)"
So now when deleting a node you need to keep in mind the following.
1. Mark the node for deletion. Lets say its node 4
2. Update the links that can point to the node we are deleting. In your case the short link as well as the long link. As we are deleting node 4 you need to first update node 3 for its short link and node 1 for its long link
3. Now safely remove the node.
Also if the if condition is not satisfied then it will not execute the if block. That means your number is never equal to longlinker -> longlink -> num