| Index: base/ref_counted_memory.h
|
| ===================================================================
|
| --- base/ref_counted_memory.h (revision 30122)
|
| +++ base/ref_counted_memory.h (working copy)
|
| @@ -19,7 +19,8 @@
|
| public:
|
| virtual ~RefCountedMemory() {}
|
|
|
| - // Retrieves a pointer to the beginning of the data we point to.
|
| + // Retrieves a pointer to the beginning of the data we point to. If the data
|
| + // is empty, this will return NULL.
|
| virtual const unsigned char* front() const = 0;
|
|
|
| // Size of the memory pointed to.
|
| @@ -64,7 +65,11 @@
|
| RefCountedBytes(const std::vector<unsigned char>& initializer)
|
| : data(initializer) {}
|
|
|
| - virtual const unsigned char* front() const { return &data.front(); }
|
| + virtual const unsigned char* front() const {
|
| + // STL will assert if we do front() on an empty vector, but calling code
|
| + // expects a NULL.
|
| + return size() ? &data.front() : NULL;
|
| + }
|
| virtual size_t size() const { return data.size(); }
|
|
|
| std::vector<unsigned char> data;
|
|
|