Comment 3 for bug 1442868

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

>How far does the "if" part go?

Without brackets, the if only covers the first following line. In other words:

if (some conditional)
  this is only called if conditional is true
  this is called regardless

Which means, you might not get the behaviour you aimed for. Apple had a pretty severe security issue for this reason a while back [1].

This is why it is a good idea to place brackets, even if it is just a single line, to make the code more explicit and avoid issues like this.

In this case it looks like the line printing the error message has been duplicated for some reason, probably accidentally.

[1] https://www.imperialviolet.org/2014/02/22/applebug.html