Remove useless else
Remove curly bracket
Also remove else with throw
Merge pull request #6334 from lucasmichot/5.0-useless-else

[5.0] Removed useless else