]> Repos - portaudio/commitdiff
Fix crashes on disconnected pins in wmdks topologies. (#300)
authorColin McEwan <colin.mcewan@gmail.com>
Thu, 19 Nov 2020 02:22:22 +0000 (02:22 +0000)
committerGitHub <noreply@github.com>
Thu, 19 Nov 2020 02:22:22 +0000 (13:22 +1100)
* Fix crashes on disconnected pins in wmdks topologies.
* Fix potential assert on disconnected physical output pin in PinNew

src/hostapi/wdmks/pa_win_wdmks.c

index 2403ed52affd7c50ae62e747efd692493009d350..15ba4388a6d312da1d77f2d80989b4d23aedfad5 100644 (file)
@@ -1057,8 +1057,9 @@ static const KSTOPOLOGY_CONNECTION* FindStartConnectionFrom(ULONG startPin, PaWi
         }
     }
 
+    /* Some devices may report topologies that leave pins unconnected. This may be by design or driver installation
+       issues. Pass the error condition back to caller. */
     PA_DEBUG(("FindStartConnectionFrom: returning NULL\n"));
-    assert(FALSE);
     return 0;
 }
 
@@ -1077,8 +1078,8 @@ static const KSTOPOLOGY_CONNECTION* FindStartConnectionTo(ULONG startPin, PaWinW
         }
     }
 
+    /* Unconnected pin. Inform caller. */
     PA_DEBUG(("FindStartConnectionTo: returning NULL\n"));
-    assert(FALSE);
     return 0;
 }
 
@@ -1970,8 +1971,8 @@ static PaWinWdmPin* PinNew(PaWinWdmFilter* parentFilter, unsigned long pinId, Pa
                                 }
                                 else
                                 {
-                                    /* Should never come here! */
-                                    assert(FALSE);
+                                    /* Unconnected pin */
+                                    goto error;
                                 }
                             }
                         }