Fix possible nullptr dereferences.

pull/3930/head
Kim Kulling 2021-05-19 00:16:15 +02:00
parent 3726b2eef4
commit 88ccfedd10
1 changed files with 6 additions and 0 deletions

View File

@ -183,12 +183,18 @@ public:
/// @brief Will return the root node, const version. /// @brief Will return the root node, const version.
/// @return The root node. /// @return The root node.
const TNodeType getRootNode() const { const TNodeType getRootNode() const {
if (nullptr == mDoc) {
return nullptr;
}
return mDoc->root(); return mDoc->root();
} }
/// @brief Will return the root node, non-const version. /// @brief Will return the root node, non-const version.
/// @return The root node. /// @return The root node.
TNodeType getRootNode() { TNodeType getRootNode() {
if (nullptr == mDoc) {
return nullptr;
}
return mDoc->root(); return mDoc->root();
} }