From: Wootak Jung Date: Wed, 26 May 2021 04:16:34 +0000 (+0900) Subject: [Bluetooth][Non-ACR] Add device name null check logic (#3086) X-Git-Tag: submit/tizen_6.0/20210526.152329~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9882a86468e53fa242e72ee5f457eb4bd53ffdf6;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Bluetooth][Non-ACR] Add device name null check logic (#3086) Signed-off-by: Wootak Jung --- diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs index e8349a0..3ac5216 100644 --- a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs @@ -266,7 +266,8 @@ namespace Tizen.Network.Bluetooth } resultDevice.RemoteDeviceAddress = device.Address; - resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(device.Name, DeviceNameLengthMax); + if (device.Name != IntPtr.Zero) + resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(device.Name, DeviceNameLengthMax); resultDevice.RemoteDeviceClass = new BluetoothClass(); resultDevice.Class.MajorType = device.Class.MajorDeviceClassType; resultDevice.Class.MinorType = device.Class.MinorDeviceClassType; @@ -305,7 +306,8 @@ namespace Tizen.Network.Bluetooth } resultDevice.RemoteDeviceAddress = structDevice.Address; - resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(structDevice.Name, DeviceNameLengthMax); + if (structDevice.Name != IntPtr.Zero) + resultDevice.RemoteDeviceName = Marshal.PtrToStringAnsi(structDevice.Name, DeviceNameLengthMax); resultDevice.RemoteDeviceClass = new BluetoothClass(); resultDevice.Class.MajorType = structDevice.Class.MajorDeviceClassType;