Use safe way to get at a vector's data pointer

&std::vector<C>[0] is not guaranteed to not throw if the
vector is empty. Better safe than sorry.
This commit is contained in:
Jonas Kulla 2014-10-09 19:02:29 +02:00
parent 1b7ed5ed78
commit 520162f36a
8 changed files with 26 additions and 13 deletions

View file

@ -101,7 +101,7 @@ int RWMemGetData(SDL_RWops *ops, void *buffer)
ByteVec *v = getRWPrivate(ops);
if (buffer)
memcpy(buffer, &(*v)[0], v->size());
memcpy(buffer, dataPtr(*v), v->size());
return v->size();
}