Skip to content

Commit 8d041a0

Browse files
authored
fix(ui): nil pointer (#6210)
Signed-off-by: Yvonnick Esnault <[email protected]>
1 parent b7ef036 commit 8d041a0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ui/src/app/model/pipeline.model.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,17 @@ export class Pipeline {
163163
s.jobs.forEach(j => {
164164
let nextJobRef;
165165
let loopAgain = true;
166+
let idxJob;
166167
do {
167168
nextJobRef = Math.random();
168-
loopAgain = editPipeline.stages.findIndex(st => st.jobs.findIndex(jb => jb.ref === nextRef) !== -1) !== -1;
169+
idxJob = editPipeline.stages.findIndex(st => {
170+
if (st && st.jobs) {
171+
return st.jobs.findIndex(jb => jb.ref === nextRef);
172+
} else {
173+
return -1;
174+
}
175+
});
176+
loopAgain = idxJob !== -1;
169177
} while (loopAgain);
170178
j.ref = nextJobRef;
171179
});

0 commit comments

Comments
 (0)