mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
SavedataParam: Be careful with const char* to string. Might help #13187
This commit is contained in:
parent
3574a352df
commit
b652f62d19
2 changed files with 6 additions and 2 deletions
|
@ -263,7 +263,11 @@ std::string SavedataParam::GetSaveFilePath(const SceUtilitySavedataParam *param,
|
|||
|
||||
inline static std::string FixedToString(const char *str, size_t n)
|
||||
{
|
||||
return std::string(str, strnlen(str, n));
|
||||
if (!str) {
|
||||
return std::string("");
|
||||
} else {
|
||||
return std::string(str, strnlen(str, n));
|
||||
}
|
||||
}
|
||||
|
||||
std::string SavedataParam::GetGameName(const SceUtilitySavedataParam *param) const
|
||||
|
|
|
@ -155,7 +155,7 @@ int ParamSFOData::GetDataOffset(const u8 *paramsfo, std::string dataName) {
|
|||
for (u32 i = 0; i < header->index_table_entries; i++)
|
||||
{
|
||||
const char *key = (const char *)(key_start + indexTables[i].key_table_offset);
|
||||
if(std::string(key) == dataName)
|
||||
if (!strcmp(key, dataName.c_str()))
|
||||
{
|
||||
return data_start + indexTables[i].data_table_offset;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue