Skip to content

Commit a4d938a

Browse files
authored
Fix: allow to_node_storage & try_get_in_node_storage on null nodes (#305)
1 parent 72d7a3b commit a4d938a

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/rdf4cpp/BlankNode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ BlankNode BlankNode::make_unchecked(std::string_view identifier, storage::DynNod
2929
}
3030

3131
BlankNode BlankNode::to_node_storage(storage::DynNodeStoragePtr node_storage) const {
32-
if (handle_.storage() == node_storage) {
32+
if (handle_.storage() == node_storage || null()) {
3333
return *this;
3434
}
3535

@@ -38,7 +38,7 @@ BlankNode BlankNode::to_node_storage(storage::DynNodeStoragePtr node_storage) co
3838
}
3939

4040
BlankNode BlankNode::try_get_in_node_storage(storage::DynNodeStoragePtr node_storage) const noexcept {
41-
if (handle_.storage() == node_storage) {
41+
if (handle_.storage() == node_storage || null()) {
4242
return *this;
4343
}
4444

src/rdf4cpp/IRI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void IRI::validate(std::string_view s) {
6161
}
6262

6363
IRI IRI::to_node_storage(storage::DynNodeStoragePtr node_storage) const {
64-
if (handle_.storage() == node_storage) {
64+
if (handle_.storage() == node_storage || null()) {
6565
return *this;
6666
}
6767

@@ -70,7 +70,7 @@ IRI IRI::to_node_storage(storage::DynNodeStoragePtr node_storage) const {
7070
}
7171

7272
IRI IRI::try_get_in_node_storage(storage::DynNodeStoragePtr node_storage) const noexcept {
73-
if (handle_.storage() == node_storage) {
73+
if (handle_.storage() == node_storage || null()) {
7474
return *this;
7575
}
7676

src/rdf4cpp/Literal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ Literal Literal::to_node_storage(storage::DynNodeStoragePtr node_storage) const
241241
using datatypes::registry::DatatypeRegistry;
242242

243243
node_storage = select_node_storage(node_storage);
244-
if (handle_.storage() == node_storage) {
244+
if (handle_.storage() == node_storage || null()) {
245245
return *this;
246246
}
247247

@@ -314,7 +314,7 @@ Literal Literal::try_get_in_node_storage(storage::DynNodeStoragePtr node_storage
314314
using datatypes::registry::DatatypeRegistry;
315315

316316
node_storage = select_node_storage(node_storage);
317-
if (handle_.storage() == node_storage) {
317+
if (handle_.storage() == node_storage || null()) {
318318
return *this;
319319
}
320320

src/rdf4cpp/query/Variable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Variable Variable::make_unchecked(std::string_view name, bool anonymous, storage
2828
}
2929

3030
Variable Variable::to_node_storage(storage::DynNodeStoragePtr node_storage) const {
31-
if (handle_.storage() == node_storage) {
31+
if (handle_.storage() == node_storage || null()) {
3232
return *this;
3333
}
3434

@@ -37,7 +37,7 @@ Variable Variable::to_node_storage(storage::DynNodeStoragePtr node_storage) cons
3737
}
3838

3939
Variable Variable::try_get_in_node_storage(storage::DynNodeStoragePtr node_storage) const noexcept {
40-
if (handle_.storage() == node_storage) {
40+
if (handle_.storage() == node_storage || null()) {
4141
return *this;
4242
}
4343

0 commit comments

Comments
 (0)