Minor fix of cellUserInfoGetStat

stat == nullptr is allowed, fix invalid id error code.
This commit is contained in:
Eladash
2020-03-20 13:15:28 +02:00
committed by Ivan
parent be0e586671
commit ae14eb0747
+7 -6
View File
@@ -33,7 +33,8 @@ error_code cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
if (id > CELL_SYSUTIL_USERID_MAX) if (id > CELL_SYSUTIL_USERID_MAX)
{ {
return CELL_USERINFO_ERROR_NOUSER; // ****** sysutil userinfo parameter error : 1 ******
return {CELL_USERINFO_ERROR_PARAM, "1"};
} }
if (id == CELL_SYSUTIL_USERID_CURRENT) if (id == CELL_SYSUTIL_USERID_CURRENT)
@@ -42,9 +43,6 @@ error_code cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
id = Emu.GetUsrId(); id = Emu.GetUsrId();
} }
if (!stat)
return CELL_USERINFO_ERROR_PARAM;
const std::string& path = vfs::get(fmt::format("/dev_hdd0/home/%08d/", id)); const std::string& path = vfs::get(fmt::format("/dev_hdd0/home/%08d/", id));
if (!fs::is_dir(path)) if (!fs::is_dir(path))
@@ -61,8 +59,11 @@ error_code cellUserInfoGetStat(u32 id, vm::ptr<CellUserInfoUserStat> stat)
return CELL_USERINFO_ERROR_INTERNAL; return CELL_USERINFO_ERROR_INTERNAL;
} }
stat->id = id; if (stat)
strcpy_trunc(stat->name, f.to_string()); {
stat->id = id;
strcpy_trunc(stat->name, f.to_string());
}
return CELL_OK; return CELL_OK;
} }