File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
plugins/jobs-management/src/JobsListWidget Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,11 @@ export function stateModelFactory(_pluginManager: PluginManager) {
62
62
*/
63
63
removeJob ( jobName : string ) {
64
64
const indx = self . jobs . findIndex ( job => job . name === jobName )
65
- const removed = self . jobs [ indx ]
66
- self . jobs . splice ( indx , 1 )
67
- return removed
65
+ if ( indx === - 1 ) {
66
+ return undefined
67
+ }
68
+ const removed = self . jobs . splice ( indx , 1 )
69
+ return removed [ 0 ]
68
70
} ,
69
71
/**
70
72
* #action
@@ -110,9 +112,11 @@ export function stateModelFactory(_pluginManager: PluginManager) {
110
112
*/
111
113
removeQueuedJob ( jobName : string ) {
112
114
const indx = self . queued . findIndex ( job => job . name === jobName )
113
- const removed = self . queued [ indx ]
114
- self . queued . splice ( indx , 1 )
115
- return removed
115
+ if ( indx === - 1 ) {
116
+ return undefined
117
+ }
118
+ const removed = self . queued . splice ( indx , 1 )
119
+ return removed [ 0 ]
116
120
} ,
117
121
/**
118
122
* #action
You can’t perform that action at this time.
0 commit comments