Skip to content
Browse files

be more defensive

  • Loading branch information...
1 parent 23e1fc8 commit f055f681ffa7571f5e1ee225c4742d2ba32db807 @tmm1 tmm1 committed Apr 27, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 ext/memprof.c
View
2 ext/memprof.c
@@ -345,7 +345,7 @@ json_print(void *ctx, const char * str, unsigned int len)
written += fwrite(str + written, sizeof(char), len - written, out ? out : stdout);
if (written == len) break;
}
- if (str[0] == '\n' && out)
+ if (str && len > 0 && str[0] == '\n' && out)
fflush(out);
}

0 comments on commit f055f68

Please sign in to comment.
Something went wrong with that request. Please try again.