--- a/src/hairtunes.c.orig	2011-09-25 23:26:56.000000000 +0200
+++ b/src/hairtunes.c	2011-09-25 23:29:27.000000000 +0200
@@ -89,7 +89,6 @@
 // maximal resampling shift - conservative
 #define OUTFRAME_BYTES (4*(frame_size+3))
 
-
 alac_file *decoder_info;
 
 #ifdef FANCY_RESAMPLING
@@ -849,6 +848,11 @@
             inbuf = buffer_get_frame();
         } while (!inbuf && audio_running);
 
+        if(!audio_running)
+        {
+          return 0; //don't access inbuf if audio stopped
+        }
+
 #ifdef FANCY_RESAMPLING
         if (fancy_resampling) {
 	        int i;
