Skip to content

Commit

Permalink
check that GetDevicePropValue is supported before calling it
Browse files Browse the repository at this point in the history
  • Loading branch information
whoozle committed Jul 29, 2024
1 parent 2a48d30 commit 35ab08b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ namespace cli
ss << ToString(code) << " ";

ss << "\nsupported properties: ";
_batterySupported = _gdi.Supports(mtp::DeviceProperty::BatteryLevel);
_deviceFriendlyNameSupported = _gdi.Supports(mtp::DeviceProperty::DeviceFriendlyName);
_batterySupported = _gdi.Supports(mtp::OperationCode::GetDevicePropValue) && _gdi.Supports(mtp::DeviceProperty::BatteryLevel);
_deviceFriendlyNameSupported = _gdi.Supports(mtp::OperationCode::GetDevicePropValue) && _gdi.Supports(mtp::DeviceProperty::DeviceFriendlyName);

for(DeviceProperty code : _gdi.DevicePropertiesSupported)
ss << ToString(code) << " ";
Expand Down

0 comments on commit 35ab08b

Please sign in to comment.