Skip to content

Commit 2b69629

Browse files
authored
A job cannot be opened if to remove an image with the latest keyframe of a track (#8952)
1 parent 0ef5857 commit 2b69629

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Fixed
2+
3+
- A job cannot be opened if to remove an image with the latest keyframe of a track
4+
(<https://github.com/cvat-ai/cvat/pull/8952>)

cvat-core/src/annotations-collection.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
MaskShape, BasicInjection, SkeletonShape,
99
SkeletonTrack, PolygonShape, CuboidShape,
1010
RectangleShape, PolylineShape, PointsShape, EllipseShape,
11+
InterpolationNotPossibleError,
1112
} from './annotations-objects';
1213
import { SerializedCollection, SerializedShape, SerializedTrack } from './server-response-types';
1314
import AnnotationsFilter from './annotations-filter';
@@ -249,12 +250,17 @@ export default class Collection {
249250
continue;
250251
}
251252

252-
const stateData = object.get(frame);
253-
if (stateData.outside && !stateData.keyframe && !allTracks && object instanceof Track) {
254-
continue;
253+
try {
254+
const stateData = object.get(frame);
255+
if (stateData.outside && !stateData.keyframe && !allTracks && object instanceof Track) {
256+
continue;
257+
}
258+
visible.push(stateData);
259+
} catch (error: unknown) {
260+
if (!(error instanceof InterpolationNotPossibleError)) {
261+
throw error;
262+
}
255263
}
256-
257-
visible.push(stateData);
258264
}
259265

260266
const objectStates = [];

cvat-core/src/annotations-objects.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ type AnnotationInjection = BasicInjection & {
8585
readOnlyFields?: string[];
8686
};
8787

88+
export class InterpolationNotPossibleError extends Error {}
89+
8890
class Annotation {
8991
public clientID: number;
9092
protected taskLabels: Record<number, Label>;
@@ -1414,10 +1416,7 @@ export class Track extends Drawn {
14141416
};
14151417
}
14161418

1417-
throw new DataError(
1418-
'No one left position or right position was found. ' +
1419-
`Interpolation impossible. Client ID: ${this.clientID}`,
1420-
);
1419+
throw new InterpolationNotPossibleError();
14211420
}
14221421
}
14231422

@@ -3275,10 +3274,7 @@ export class SkeletonTrack extends Track {
32753274
};
32763275
}
32773276

3278-
throw new DataError(
3279-
'No one left position or right position was found. ' +
3280-
`Interpolation impossible. Client ID: ${this.clientID}`,
3281-
);
3277+
throw new InterpolationNotPossibleError();
32823278
}
32833279
}
32843280

0 commit comments

Comments
 (0)