Patch for erro handling

This commit is contained in:
Vishal Pradhan 2024-01-29 15:05:35 +05:30
parent c5f579e714
commit d374101df8

View file

@ -0,0 +1,34 @@
From c5f579e7149dcdf8b9c6aed53012b2cfe1fef606 Mon Sep 17 00:00:00 2001
From: Vishal Pradhan <vishal.pradhan@aalda.in>
Date: Mon, 29 Jan 2024 15:02:46 +0530
Subject: [PATCH] changes for error handling
---
src/components/modules/caret.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/modules/caret.ts b/src/components/modules/caret.ts
index 425c8d5..3dc51f4 100644
--- a/src/components/modules/caret.ts
+++ b/src/components/modules/caret.ts
@@ -60,7 +60,7 @@ export default class Caret extends Module {
/** In case lastNode is native input */
if ($.isNativeInput(firstNode)) {
- return (firstNode as HTMLInputElement).selectionEnd === 0;
+ return (firstNode as HTMLInputElement)?.selectionEnd === 0;
}
/** Case when selection have been cleared programmatically, for example after CBS */
@@ -162,7 +162,7 @@ export default class Caret extends Module {
/** In case lastNode is native input */
if ($.isNativeInput(lastNode)) {
- return (lastNode as HTMLInputElement).selectionEnd === (lastNode as HTMLInputElement).value.length;
+ return (lastNode as HTMLInputElement)?.selectionEnd === (lastNode as HTMLInputElement).value.length;
}
/** Case when selection have been cleared programmatically, for example after CBS */
--
2.39.3 (Apple Git-145)