input: add missing nullptr checks for pad
This commit is contained in:
@@ -431,6 +431,11 @@ void PadHandlerBase::TranslateButtonPress(const std::shared_ptr<PadDevice>& devi
|
|||||||
|
|
||||||
bool PadHandlerBase::bindPadToDevice(std::shared_ptr<Pad> pad, const std::string& device, u8 player_id)
|
bool PadHandlerBase::bindPadToDevice(std::shared_ptr<Pad> pad, const std::string& device, u8 player_id)
|
||||||
{
|
{
|
||||||
|
if (!pad)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<PadDevice> pad_device = get_device(device);
|
std::shared_ptr<PadDevice> pad_device = get_device(device);
|
||||||
if (!pad_device)
|
if (!pad_device)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -750,7 +750,7 @@ std::string keyboard_pad_handler::native_scan_code_to_string(int native_scan_cod
|
|||||||
|
|
||||||
bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::string& device, u8 player_id)
|
bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::string& device, u8 player_id)
|
||||||
{
|
{
|
||||||
if (device != pad::keyboard_device_name)
|
if (!pad || device != pad::keyboard_device_name)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_pad_configs[player_id].from_string(g_cfg_input.player[player_id]->config.to_string());
|
m_pad_configs[player_id].from_string(g_cfg_input.player[player_id]->config.to_string());
|
||||||
|
|||||||
Reference in New Issue
Block a user