Skip to content

Commit 4461c2d

Browse files
committed
CA fixes
1 parent aac8112 commit 4461c2d

4 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/dinput_backend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class DInputBackend final : public IInputBackend
4141
* Human-readable display name for a specific slot.
4242
* @param slot Index of the input slot to query.
4343
* @returns Pointer to a null-terminated string describing the slot or its assigned device.
44+
* May return nullptr when no slot/device mapping exists or when no name is available.
4445
*/
4546
void Poll() override;
4647
[[nodiscard]] int GetMaxSlots() const override;

src/hidapi_backend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class HidApiBackend final : public IInputBackend
4141
/**
4242
* Get a human-readable display name for the device assigned to a slot.
4343
* @param slot Index of the slot to query; valid range is 0 .. GetMaxSlots()-1.
44-
* @returns Null-terminated display name for the slot, or an empty string if none.
44+
* @returns A null-terminated display name for the slot, or nullptr when no name is available.
4545
*/
4646

4747
/**

src/rawinput_backend.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ const char* RawInputBackend::GetSlotDisplayName(int slot) const
8686

8787
PHIDP_PREPARSED_DATA RawInputBackend::PP(DeviceInfo& d)
8888
{
89+
if (d.preparsedBuf.empty())
90+
return nullptr;
8991
return reinterpret_cast<PHIDP_PREPARSED_DATA>(d.preparsedBuf.data());
9092
}
9193

src/rawinput_backend.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class RawInputBackend final : public IInputBackend
4646
* Return the display name for a specific slot.
4747
*
4848
* @param slot Index of the slot to query (0-based).
49-
* @returns A null-terminated string containing the display name for the slot, or an empty string if none.
49+
* @returns A null-terminated string on success; nullptr when no display name is available.
50+
* The returned pointer is valid for the lifetime of this backend; caller does not take ownership.
5051
*/
5152

5253
/**

0 commit comments

Comments
 (0)