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

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