“Obey the law” does not mean submit to authority. Martin Luther King believed in nonviolence and Malcolm believed in self-defense, but they had more in common than not, including a preference for legal protest. It's tactically wise. A speaker is more effective in public than in prison.
Because Malcolm believed in self-defense, his “if” is essential: Has no one laid hands on you? Stay peaceful, courteous, and respectful.
Nothing in his code kept him from demanding justice, as you may see by watching any of his speeches or interviews.
ETA 11/1/17: At Facebook, I wrote a little more about the Malcolm X Code of Behavior:
Online, no one can put a hand on you, so abide by the first half of the code. We know he meant us to interpret "puts his hand on you" literally because he was civil to everyone, including George Rockwell, founder of the American Nazi Party.
Possibly relevant: I discuss cowboy codes of the early 20th century in A little about America's idea of cowboys and traditional male values. They have a lot in common with Malcolm's code.