SDL: touch: Don't call ResetTouch() if SDL_GetTouch() can't find a virtual device.

From 289f5cfdbb7a1abac39e7408a2811bb997ad7daa Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 27 Mar 2025 12:01:02 -0400
Subject: [PATCH] touch: Don't call ResetTouch() if SDL_GetTouch() can't find a
 virtual device.

Fixes #12577.
---
 src/events/SDL_touch.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
index ec4acb14b62ae..e825117c82a7e 100644
--- a/src/events/SDL_touch.c
+++ b/src/events/SDL_touch.c
@@ -83,9 +83,11 @@ SDL_Touch *SDL_GetTouch(SDL_TouchID id)
 {
     int index = SDL_GetTouchIndex(id);
     if (index < 0 || index >= SDL_num_touch) {
-        if (SDL_GetVideoDevice()->ResetTouch != NULL) {
+        if ((id == SDL_MOUSE_TOUCHID) || (id == SDL_PEN_TOUCHID)) {
+            // this is a virtual touch device, but for some reason they aren't added to the system. Just ignore it.
+        } else if ( SDL_GetVideoDevice()->ResetTouch) {
             SDL_SetError("Unknown touch id %d, resetting", (int)id);
-            (SDL_GetVideoDevice()->ResetTouch)(SDL_GetVideoDevice());
+            SDL_GetVideoDevice()->ResetTouch(SDL_GetVideoDevice());
         } else {
             SDL_SetError("Unknown touch device id %d, cannot reset", (int)id);
         }