From ca12acb6cb9b1f7618b88f2c95efd8ab275e1f57 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Sun, 9 Oct 2011 20:29:05 +0000
Subject: Attempted blind fix for #778.

git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3538 a436a847-0d15-0410-975c-d299462d15a1
---
 src/server/PostProcessor.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'src')

diff --git a/src/server/PostProcessor.cpp b/src/server/PostProcessor.cpp
index 3cd05992..d9195027 100644
--- a/src/server/PostProcessor.cpp
+++ b/src/server/PostProcessor.cpp
@@ -73,11 +73,13 @@ PostProcessor::process()
 	/* Process audio thread generated events */
 	Driver* driver = _engine.driver();
 	if (driver) {
-		Notification   note;
-		const uint32_t read_space = driver->context().event_sink().read_space();
+		Raul::RingBuffer& event_sink = driver->context().event_sink();
+		const uint32_t    read_space = event_sink.read_space();
+		Notification      note;
 		for (uint32_t i = 0; i < read_space; i += sizeof(note)) {
-			driver->context().event_sink().read(sizeof(note), &note);
-			Notification::post_process(note, _engine);
+			if (event_sink.read(sizeof(note), &note) == sizeof(note)) {
+				Notification::post_process(note, _engine);
+			}
 		}
 	}
 
-- 
cgit v1.2.1