Permalink
Browse files

Check decoder's state function for NULL before calling it

  • Loading branch information...
1 parent 8db8c45 commit a8721c3c04f41f0b90a4b1ebaf4bcd767c45a6ab @hurtonm hurtonm committed Nov 21, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/decoder.hpp
View
@@ -148,6 +148,10 @@ namespace zmq
// False is returned if the decoder has encountered an error.
bool stalled ()
{
+ // Check whether there was decoding error.
+ if (unlikely (static_cast <T*> (this)->next == NULL))
+ return false;
+
while (!to_read) {
if (!(static_cast <T*> (this)->*next) ()) {
if (unlikely (!(static_cast <T*> (this)->next)))

1 comment on commit a8721c3

Please sign in to comment.