diff --git a/lib/dbus/bus.rb b/lib/dbus/bus.rb
index <HASH>..<HASH> 100644
--- a/lib/dbus/bus.rb
+++ b/lib/dbus/bus.rb
@@ -435,6 +435,7 @@ module DBus
     # Get one message from the bus and remove it from the buffer.
     # Return the message.
     def pop_message
+      return nil if @buffer.empty?
       ret = nil
       begin
         ret, size = Message.new.unmarshall_buffer(@buffer)
Don't process an empty buffer

pop_message might be called on an empty buffer, resulting in 'popping'
garbage from the buffer.