Skip to content

Commit

Permalink
Fixed "Cannot read properties of undefined (reading 'toLowerCase')" (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored Feb 1, 2024
1 parent e4aa63f commit b539802
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog.d/20240201_123603_boris_fixed_exception.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Unhandled exception "Cannot read properties of undefined (reading 'toLowerCase')"
(<https://github.com/opencv/cvat/pull/7421>)
4 changes: 2 additions & 2 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
}

private onShiftKeyDown = (e: KeyboardEvent): void => {
if (!e.repeat && e.code.toLowerCase().includes('shift')) {
if (!e.repeat && (e.code || '').toLowerCase().includes('shift')) {
this.snapToAngleResize = consts.SNAP_TO_ANGLE_RESIZE_SHIFT;
if (this.activeElement) {
const shape = this.svgShapes[this.activeElement.clientID];
Expand All @@ -1126,7 +1126,7 @@ export class CanvasViewImpl implements CanvasView, Listener {
};

private onShiftKeyUp = (e: KeyboardEvent): void => {
if (e.code.toLowerCase().includes('shift') && this.activeElement) {
if ((e.code || '').toLowerCase().includes('shift') && this.activeElement) {
this.snapToAngleResize = consts.SNAP_TO_ANGLE_RESIZE_DEFAULT;
if (this.activeElement) {
const shape = this.svgShapes[this.activeElement.clientID];
Expand Down

0 comments on commit b539802

Please sign in to comment.