From 1fb229b8d3a76eacbbe796242338a56fdcd676ec Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Tue, 20 Oct 2015 19:04:07 -0400
Subject: [PATCH] ported from pd-l2ork git: commit
 82c417caafb5dd330fb7edf79359a623bdafedce *added a fallback sr in case
 everything else fails

---
 pd/src/s_audio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c
index aea98525b..d5a8e9b29 100644
--- a/pd/src/s_audio.c
+++ b/pd/src/s_audio.c
@@ -568,9 +568,11 @@ t_float sys_getsr(void)
     // proper sample rate entered. Hence, we check for this here and avoid
     // the -nogui nonsense where we have to do various workarounds to make
     // sure that audio objects that depend on this call get the proper sr
-    if (sys_dacsr == 0 && audio_rate > 0)
+    if (sys_dacsr == 0)
     {
-        sys_dacsr = (t_float)audio_rate;
+        if (audio_rate > 0)
+            sys_dacsr = (t_float)audio_rate;
+        else sys_dacsr = 44100; // safe fallback
     }
     return (sys_dacsr);
 }
-- 
GitLab