[Bluetooth] Representation of binary data unification - exceptions fix 84/243984/1
authorArkadiusz Pietraszek <a.pietraszek@samsung.com>
Fri, 11 Sep 2020 17:18:59 +0000 (19:18 +0200)
committerArkadiusz Pietraszek <a.pietraszek@samsung.com>
Fri, 11 Sep 2020 17:18:59 +0000 (19:18 +0200)
Fixed misarg case. Before TypeError was thrown.
Corrected to TypeMismachError.

[Verification] Errors tested in developer console.

[ACR] TWDAPI-259

Change-Id: Ifdfc9682ed31f2cbb9f16d0d63cb2056412a9236
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
src/bluetooth/bluetooth_api.js

index 0564ba6..f6f4061 100755 (executable)
@@ -3617,7 +3617,7 @@ BluetoothManager.prototype.toByteArray = function(data) {
 };
 
 var BluetoothManager_toDOMString = function(data) {
-    if (String === data.constructor) {
+    if (data && String === data.constructor) {
         data = BluetoothManager_checkAndNormalizeHexString(data);
         if (0 !== data.length) {
             data = '0x' + data;
@@ -3634,7 +3634,7 @@ BluetoothManager.prototype.toDOMString = function(data) {
 };
 
 var BluetoothManager_toUint8Array = function(data) {
-    if (String === data.constructor) {
+    if (data && String === data.constructor) {
         return BluetoothManager_HexStringToUint8Array(data);
     } else {
         try {