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
|
@ -784,7 +784,7 @@ std::size_t ReadFileToString(bool text_file, const std::string& filename, std::s
|
|||
return 0;
|
||||
|
||||
str.resize(static_cast<u32>(file.GetSize()));
|
||||
return file.ReadArray(&str[0], str.size());
|
||||
return file.ReadArray(str.data(), str.size());
|
||||
}
|
||||
|
||||
void SplitFilename83(const std::string& filename, std::array<char, 9>& short_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue