Correcting bug with menu as null

In previous version, I didn't test if menu is not null to use it
The version 1.7.1 correcting it.