Fix handling of empty strings in NIF string tables

pull/2719/head
Capostrophic 5 years ago
parent d9f147272c
commit aef6cd7006

@ -266,7 +266,7 @@ namespace
MOCK_CONST_METHOD0(numRecords, std::size_t ());
MOCK_CONST_METHOD1(getRoot, Nif::Record* (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_CONST_METHOD0(getUseSkinning, bool ());
MOCK_CONST_METHOD0(getFilename, std::string ());

@ -26,7 +26,7 @@ struct File
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;
@ -129,8 +129,10 @@ public:
size_t numRoots() const override { return roots.size(); }
/// 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);
}

Loading…
Cancel
Save