Fixed a crash on inputs like ls x>| less, where x doesn't exist in current directory.

This commit is contained in:
Siteshwar Vashisht 2012-03-16 00:30:27 +05:30
parent 63b330439e
commit ebfcee6e67

2
io.h
View File

@ -73,7 +73,7 @@ public:
/** Function to get a pointer to the buffer */ /** Function to get a pointer to the buffer */
char *out_buffer_ptr(void) { char *out_buffer_ptr(void) {
assert(out_buffer.get() != NULL); assert(out_buffer.get() != NULL);
return &out_buffer->at(0); return (out_buffer->size() == 0) ? NULL : &out_buffer->at(0);
} }
/** Function to get the size of the buffer */ /** Function to get the size of the buffer */