I think it would be cleaner to have these two lines executed unconditionally above along with hiding the other two buttons.  Slightly more code, but this is not performance sensitive.