Hello Robert,
I suppose you are showing the ContextMenu based on the clicked menu item. So if you right click on the ListBox other than an item, there won't be any item and
e.get_item() will be null, that's why the error comes. So one suggestion is to check whether
e.get_item() is null or not, before showing the ContextMenu. Here is a sample code.
Thanks,
Shinu.