Replace &vec[0]
with vec.data()
When the vector is empty, using `&vec[0]` involves undefined behaviour. While that works fine most of the time, Flatpak builds aborted on a failed `__builtin_expect`. I searched for such occurences across the codebase with the regex `(?<!&)&\w+\[0\]` and fixed those that would potentially cause issues.
This commit is contained in:
parent
5241032fc5
commit
f85bde3ca3
3 changed files with 7 additions and 6 deletions
|
@ -342,7 +342,7 @@ ResultStatus AppLoader_THREEDSX::ReadIcon(std::vector<u8>& buffer) {
|
|||
file.Seek(hdr.smdh_offset, SEEK_SET);
|
||||
buffer.resize(hdr.smdh_size);
|
||||
|
||||
if (file.ReadBytes(&buffer[0], hdr.smdh_size) != hdr.smdh_size)
|
||||
if (file.ReadBytes(buffer.data(), hdr.smdh_size) != hdr.smdh_size)
|
||||
return ResultStatus::Error;
|
||||
|
||||
return ResultStatus::Success;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue