@@ -244,6 +244,7 @@ MenuManager::MenuManager(HWND hNotepad, HINSTANCE hInst, void(*runScript)(const
244244/* This code was shamefully robbed from NppExec from Dovgan Vitaliy*/
245245HMENU MenuManager::getOurMenu ()
246246{
247+ assert (m_funcItems != NULL );
247248 if (m_funcItems && NULL == m_pythonPluginMenu)
248249 {
249250 HMENU hPluginMenu = (HMENU)::SendMessage (m_hNotepad, NPPM_GETMENUHANDLE, 0 , 0 );
@@ -348,6 +349,7 @@ void MenuManager::refreshScriptsMenu()
348349
349350 m_submenus.erase (m_submenus.begin (), m_submenus.end ());
350351
352+ assert (m_scriptsMenuManager != NULL );
351353 if (m_scriptsMenuManager)
352354 {
353355 m_scriptsMenuManager->begin ();
@@ -364,6 +366,7 @@ void MenuManager::refreshScriptsMenu()
364366
365367int MenuManager::getOriginalCommandID (int scriptNumber)
366368{
369+ assert (m_funcItems != NULL );
367370 int retVal = 0 ;
368371 if (m_funcItems && ((scriptNumber < m_originalDynamicCount) && (scriptNumber < m_dynamicCount)))
369372 {
@@ -375,6 +378,7 @@ int MenuManager::getOriginalCommandID(int scriptNumber)
375378
376379bool MenuManager::findScripts (HMENU hBaseMenu, int basePathLength, string& path)
377380{
381+ assert (m_scriptsMenuManager != NULL );
378382 if (!m_scriptsMenuManager)
379383 {
380384 return false ;
@@ -751,6 +755,7 @@ void MenuManager::reconfigure()
751755
752756void MenuManager::configureToolbarIcons ()
753757{
758+ assert (m_toolbarMenuManager != NULL );
754759 if (!m_toolbarMenuManager)
755760 {
756761 return ;
@@ -976,6 +981,7 @@ int MenuManager::findMenuCommand(HMENU hParentMenu, const TCHAR *menuName, const
976981
977982void MenuManager::initPreviousScript ()
978983{
984+ assert (m_funcItems != NULL );
979985 ShortcutKey key;
980986 if (m_funcItems && ::SendMessage (m_hNotepad, NPPM_GETSHORTCUTBYCMDID, m_funcItems[m_runPreviousIndex]._cmdID , reinterpret_cast <LPARAM>(&key)))
981987 {
@@ -988,6 +994,7 @@ void MenuManager::initPreviousScript()
988994
989995void MenuManager::updateShortcut (UINT cmdID, ShortcutKey* key)
990996{
997+ assert (m_funcItems != NULL );
991998 if (m_funcItems && cmdID == static_cast <UINT>(m_funcItems[m_runPreviousIndex]._cmdID ))
992999 {
9931000 if (key && key->_key != VK_NULL)
@@ -1038,6 +1045,7 @@ void MenuManager::updatePreviousScript(const char *filename)
10381045
10391046void MenuManager::idsInitialised ()
10401047{
1048+ assert (m_funcItems != NULL );
10411049 if (!m_funcItems)
10421050 {
10431051 return ;
@@ -1085,16 +1093,20 @@ void MenuManager::idsInitialised()
10851093
10861094bool MenuManager::inToolbarRange (int commandID)
10871095{
1096+ assert (m_toolbarMenuManager != NULL );
10881097 return m_toolbarMenuManager && m_toolbarMenuManager->inRange (commandID);
10891098}
10901099
10911100bool MenuManager::inDynamicRange (int commandID)
10921101{
1102+ assert (m_dynamicMenuManager != NULL );
1103+ assert (m_scriptsMenuManager != NULL );
10931104 return ((m_dynamicMenuManager && m_dynamicMenuManager->inRange (commandID)) ||
10941105 (m_scriptsMenuManager && m_scriptsMenuManager->inRange (commandID)));
10951106}
10961107
10971108bool MenuManager::inFixedRange (int commandID)
10981109{
1110+ assert (m_originalDynamicMenuManager != NULL );
10991111 return m_originalDynamicMenuManager && m_originalDynamicMenuManager->inRange (commandID);
11001112}
0 commit comments