1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:23:52 +00:00

Fix handling of empty strings in NIF string tables

This commit is contained in:
Capostrophic 2020-03-10 22:44:50 +03:00
parent d9f147272c
commit aef6cd7006
2 changed files with 5 additions and 3 deletions

View file

@ -266,7 +266,7 @@ namespace
MOCK_CONST_METHOD0(numRecords, std::size_t ()); MOCK_CONST_METHOD0(numRecords, std::size_t ());
MOCK_CONST_METHOD1(getRoot, Nif::Record* (std::size_t)); MOCK_CONST_METHOD1(getRoot, Nif::Record* (std::size_t));
MOCK_CONST_METHOD0(numRoots, std::size_t ()); MOCK_CONST_METHOD0(numRoots, std::size_t ());
MOCK_CONST_METHOD1(getString, std::string (std::size_t)); MOCK_CONST_METHOD1(getString, std::string (uint32_t));
MOCK_METHOD1(setUseSkinning, void (bool)); MOCK_METHOD1(setUseSkinning, void (bool));
MOCK_CONST_METHOD0(getUseSkinning, bool ()); MOCK_CONST_METHOD0(getUseSkinning, bool ());
MOCK_CONST_METHOD0(getFilename, std::string ()); MOCK_CONST_METHOD0(getFilename, std::string ());

View file

@ -26,7 +26,7 @@ struct File
virtual size_t numRoots() const = 0; virtual size_t numRoots() const = 0;
virtual std::string getString(size_t index) const = 0; virtual std::string getString(uint32_t index) const = 0;
virtual void setUseSkinning(bool skinning) = 0; virtual void setUseSkinning(bool skinning) = 0;
@ -129,8 +129,10 @@ public:
size_t numRoots() const override { return roots.size(); } size_t numRoots() const override { return roots.size(); }
/// Get a given string from the file's string table /// Get a given string from the file's string table
std::string getString(size_t index) const override std::string getString(uint32_t index) const override
{ {
if (index == std::numeric_limits<uint32_t>::max())
return std::string();
return strings.at(index); return strings.at(index);
} }