fix various coverity issues

This commit is contained in:
wmayer
2017-09-15 11:48:38 +02:00
parent a3953e95df
commit fde42545ba
17 changed files with 83 additions and 21 deletions

View File

@@ -95,19 +95,25 @@ bool ExtensionContainer::hasExtension(const std::string& name) const {
Extension* ExtensionContainer::getExtension(Base::Type t, bool derived) const {
auto result = _extensions.find(t);
if((result == _extensions.end()) && derived) {
//we need to check for derived types
for(auto entry : _extensions) {
for(auto entry : _extensions) {
if(entry.first.isDerivedFrom(t))
return entry.second;
}
//if we arive hear we don't have anything matching
//if we arrive here we don't have anything matching
throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available");
}
else if (result != _extensions.end()) {
return result->second;
}
else {
//if we arrive here we don't have anything matching
throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available");
}
return result->second;
}
bool ExtensionContainer::hasExtensions() const {