@@ -559,11 +559,16 @@ Item {
559559 // canSubmitOrCompute: return int n : 0 >= n <= 3 | n=0 cannot submit or compute | n=1 can compute | n=2 can submit | n=3 can compute & submit
560560 property int canSubmitOrCompute: currentNode != null && uigraph .graph .canSubmitOrCompute (currentNode)
561561 property bool isComputed: {
562+ var count = 0
562563 for (var i = 0 ; i < uigraph .selectedNodes .count ; ++ i) {
563- if (! uigraph .selectedNodes .at (i).isComputed )
564+ var node = uigraph .selectedNodes .at (i)
565+ if (! node)
566+ continue
567+ if (! node .isComputed )
564568 return false
569+ count += 1
565570 }
566- return uigraph . selectedNodes . count > 0
571+ return count > 0
567572 }
568573 width: 220
569574 onClosed: currentNode = null
@@ -573,27 +578,34 @@ Item {
573578 property bool recompute: false
574579 text: nodeMenu .isComputed ? " Recompute" : " Compute"
575580 visible: {
581+ var count = 0
576582 for (var i = 0 ; i < uigraph .selectedNodes .count ; ++ i) {
577- if (! uigraph .selectedNodes .at (i).isComputable )
583+ var node = uigraph .selectedNodes .at (i)
584+ if (! node)
585+ continue
586+ if (! node .isComputable )
578587 return false
588+ count += 1
579589 }
580- return uigraph . selectedNodes . count > 0
590+ return count > 0
581591 }
582592 height: visible ? implicitHeight : 0
583593
584594 enabled: {
585595 var canCompute = false
586596 for (var i = 0 ; i < uigraph .selectedNodes .count ; ++ i) {
587- if (uigraph .graph .canComputeTopologically (uigraph .selectedNodes .at (i))) {
597+ var node = uigraph .selectedNodes .at (i)
598+ if (! node)
599+ continue
600+ if (uigraph .graph .canComputeTopologically (node)) {
588601 if (nodeMenu .isComputed ) {
589602 canCompute = true
590- } else if (uigraph .graph .canSubmitOrCompute (uigraph . selectedNodes . at (i) ) % 2 == 1 ) {
603+ } else if (uigraph .graph .canSubmitOrCompute (node ) % 2 == 1 ) {
591604 canCompute = true
592605 }
593606 }
594607 }
595608 return canCompute // canSubmit if canSubmitOrCompute == 1(can compute) or 3(can compute & submit)
596-
597609 }
598610
599611 onTriggered: {
@@ -610,21 +622,27 @@ Item {
610622 property bool resubmit: false
611623 text: nodeMenu .isComputed ? " Re-Submit" : " Submit"
612624 visible: {
625+ var count = 0
613626 for (var i = 0 ; i < uigraph .selectedNodes .count ; ++ i) {
614- if (! uigraph .selectedNodes .at (i).isComputable )
627+ var node = uigraph .selectedNodes .at (i)
628+ if (node && ! node .isComputable )
615629 return false
630+ count += 1
616631 }
617- return uigraph . selectedNodes . count > 0 || uigraph .canSubmit
632+ return count > 0 || uigraph .canSubmit
618633 }
619634 height: visible ? implicitHeight : 0
620635
621636 enabled: {
622637 var canSubmit = false
623638 for (var i = 0 ; i < uigraph .selectedNodes .count ; ++ i) {
624- if (uigraph .graph .canComputeTopologically (uigraph .selectedNodes .at (i))) {
639+ var node = uigraph .selectedNodes .at (i)
640+ if (! node)
641+ continue
642+ if (uigraph .graph .canComputeTopologically (node)) {
625643 if (nodeMenu .isComputed ) {
626644 canSubmit = true
627- } else if (uigraph .graph .canSubmitOrCompute (uigraph . selectedNodes . at (i) ) > 1 ) {
645+ } else if (uigraph .graph .canSubmitOrCompute (node ) > 1 ) {
628646 canSubmit = true
629647 }
630648 }
0 commit comments