How about if the law is written so strictly that everything is an offense, such that it's impossible to enforce on everyone, and you choose to not enforce it against people you like? Any case where it is enforced, you can still point to the law and say the outcome aligned with it.
And what if the law unequivocally says a certain group of people are slaves, is this justified simply because the outcome is not arbitrary and there is a codified rule of law? Whether the law is right or wrong does matter.
Edit in reply to below: the issue in China is precisely that the government's response to criticism is unpredictable. If Xi Jinping criticizes Chinese policy, that means a new policy is now in place. If a random guy on the street criticizes Chinese policy... maybe he'll be fine? Or maybe not. Depending on where and to whom he says it and how nice public officials are feeling that day.