Commits

Arjan Scherpenisse  committed 1042e35

mod_menu - fix crash on empty menu.

  • Participants
  • Parent commits 4d5dad7

Comments (0)

Files changed (1)

File modules/mod_menu/mod_menu.erl

         menu_ids(T, [H|Acc]).
 
 
-%% @doc Fetch the menu from the site configuration.
+%% @doc Fetch the default menu. Performs validation/visibility checking on the menu items.
 %% @spec get_menu(Context) -> list()
 get_menu(Context) ->
     get_menu(m_rsc:rid(main_menu, Context), Context).
 
+%% @doc Fetch a menu structure from a rsc. Performs validation/visibility checking on the menu items.
+%% @spec get_menu(Id, Context) -> list()
 get_menu(Id, Context) ->
     case m_rsc:p(Id, menu, Context) of
         undefined -> [];
+        <<>> -> [];
         Menu -> remove_invisible(validate(Menu, []), [], Context)
     end.