File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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 /* *
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ const char* RawInputBackend::GetSlotDisplayName(int slot) const
8686
8787PHIDP_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
Original file line number Diff line number Diff 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 /* *
You can’t perform that action at this time.
0 commit comments