[Bluetooth][Non-ACR] Add NULL check logic for Marshal.PtrToStringAnsi (#1658)
authordh79pyun <31202060+dh79pyun@users.noreply.github.com>
Thu, 4 Jun 2020 23:45:40 +0000 (08:45 +0900)
committerGitHub <noreply@github.com>
Thu, 4 Jun 2020 23:45:40 +0000 (08:45 +0900)
commitaf24e1c2fc844c03938a4d0ca7606dd763da0d66
tree855835882c494f7c09b560e767487064ef10b459
parent0b20fd6a0e70a97157d2f83843a5b1c60bb95fbf
[Bluetooth][Non-ACR] Add NULL check logic for Marshal.PtrToStringAnsi (#1658)

This patchset is to avoid ArgumentNullException error. There are some
cases to come NULL variable from Native API.

BluetoothAdapterImpl.cs: RegisterDiscoveryStateChangedEvent(258) > Discovery state changed callback is called
Unhandled exception.
System.ArgumentNullException: Value cannot be null. (Parameter 'ptr')
at System.Runtime.InteropServices.Marshal.PtrToStringAnsi(IntPtr ptr, Int32 len)
at Tizen.Network.Bluetooth.BluetoothUtils.ConvertStructToDiscoveredDevice(BluetoothDiscoveredDeviceStruct structDevice)
at Tizen.Network.Bluetooth.BluetoothAdapterImpl.<RegisterDiscoveryStateChangedEvent>b__45_0(Int32 result, BluetoothDeviceDiscoveryState state, IntPtr deviceInfo, IntPtr user

Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs