From 7ec3a35354e8f06f8cddc4adaf1be32266f94a80 Mon Sep 17 00:00:00 2001
From: Robin Nehls <nehls@mi.fu-berlin.de>
Date: Tue, 5 Jan 2010 15:42:46 +0100
Subject: Added check to ringbuffer if a given targetbuffer is NULL

---
 src/base/ringbuffer.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'src')

diff --git a/src/base/ringbuffer.cpp b/src/base/ringbuffer.cpp
index 7adcd332..d324f74f 100644
--- a/src/base/ringbuffer.cpp
+++ b/src/base/ringbuffer.cpp
@@ -51,6 +51,10 @@ namespace usdx
 		if (count <= 0)
 			return count;
 
+		// check if the buffer is NULL
+		if (buffer == NULL)
+			return -1;
+
 		// adjust output count
 		if (count > buffer_count)
 		{
@@ -81,6 +85,10 @@ namespace usdx
 		if (count <= 0)
 			return count;
 
+		// check if the buffer is NULL
+		if (buffer == NULL)
+			return -1;
+
 		// skip input data if the input buffer is bigger than the ring-buffer
 		if (count > buffer_size)
 		{
-- 
cgit v1.2.3