From c984afdf47ef31511024c6b70bd4b4c4e64f56a6 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 8 Jul 2023 23:30:25 +0500 Subject: Fixed some errors detected by static analysis --- src/Rml.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Rml.cpp') diff --git a/src/Rml.cpp b/src/Rml.cpp index f6fff44..7f114cd 100644 --- a/src/Rml.cpp +++ b/src/Rml.cpp @@ -161,7 +161,8 @@ bool RmlRenderInterface::GenerateTexture(Rml::TextureHandle& texture_handle, con } void RmlRenderInterface::ReleaseTexture(Rml::TextureHandle texture) { - textures.erase(textures.find(texture)); + if (auto it = textures.find(texture); it != textures.end()) + textures.erase(it); } void RmlRenderInterface::Update(unsigned int windowWidth, unsigned int windowHeight) { @@ -183,7 +184,7 @@ Rml::FileHandle RmlFileInterface::Open(const Rml::String& path) { handle.filePos = 0; if (handle.assetPtr != nullptr) - handles.insert(std::make_pair(fileId, handle)); + handles.try_emplace(fileId, handle); else fileId = 0; return fileId; -- cgit v1.2.3