@@ -292,21 +292,27 @@ private void displayInstructions(TreeNode connectionNode, QpInstruction[] instru
292292 {
293293 var instructionNode = connectionNode . Nodes . Add ( instruction . Id , instruction . Name , 2 , 2 ) ;
294294 instructionNode . Tag = instruction ;
295- var noticesNode = instructionNode . Nodes . Add ( "Notice" , "通知" , 3 , 3 ) ;
296- noticesNode . Tag = instruction . NoticeInfos ;
297- foreach ( var noticeInfo in instruction . NoticeInfos )
295+ if ( instruction . NoticeInfos != null )
298296 {
299- var noticeNode = noticesNode . Nodes . Add ( noticeInfo . NoticeTypeName , noticeInfo . Name , 3 , 3 ) ;
300- noticeNode . ContextMenuStrip = cmsNotice ;
301- noticeNode . Tag = noticeInfo ;
297+ var noticesNode = instructionNode . Nodes . Add ( "Notice" , "通知" , 3 , 3 ) ;
298+ noticesNode . Tag = instruction . NoticeInfos ;
299+ foreach ( var noticeInfo in instruction . NoticeInfos )
300+ {
301+ var noticeNode = noticesNode . Nodes . Add ( noticeInfo . NoticeTypeName , noticeInfo . Name , 3 , 3 ) ;
302+ noticeNode . ContextMenuStrip = cmsNotice ;
303+ noticeNode . Tag = noticeInfo ;
304+ }
302305 }
303- var commandsNode = instructionNode . Nodes . Add ( "Command" , "命令" , 4 , 4 ) ;
304- commandsNode . Tag = instruction . CommandInfos ;
305- foreach ( var commandInfo in instruction . CommandInfos )
306+ if ( instruction . CommandInfos != null )
306307 {
307- var commandNode = commandsNode . Nodes . Add ( commandInfo . RequestTypeName , commandInfo . Name , 4 , 4 ) ;
308- commandNode . ContextMenuStrip = cmsCommand ;
309- commandNode . Tag = commandInfo ;
308+ var commandsNode = instructionNode . Nodes . Add ( "Command" , "命令" , 4 , 4 ) ;
309+ commandsNode . Tag = instruction . CommandInfos ;
310+ foreach ( var commandInfo in instruction . CommandInfos )
311+ {
312+ var commandNode = commandsNode . Nodes . Add ( commandInfo . RequestTypeName , commandInfo . Name , 4 , 4 ) ;
313+ commandNode . ContextMenuStrip = cmsCommand ;
314+ commandNode . Tag = commandInfo ;
315+ }
310316 }
311317 }
312318 }
0 commit comments