OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-storage commits / aaf1dc1

iBug-fix the size check.
aaf1dc10f453391f5bf693b855a234fe98668ec8
by Linas Vepstas <linasvepstas@gmail.com> · 2026-01-18T21:33:32.000Z

Changed files (1) +11 -2

opencog/persist/api/StorageNode.cc +11 -2
……@@ -50,14 +50,20 @@ StorageNode::~StorageNode()
5050{
5151}
5252
53/// Evaluate the ValuePtr, trying to get an AtomSpace out of it,
54/// either directly, or by execution. If the result is null, then
55/// use the StorageNode atomspace as the default.
5356AtomSpace* StorageNode::get_target_as(const ValuePtr& value) const
5457{
55 if (nullptr == value or 0 == value->size())
58 if (nullptr == value)
5659 return _target_as.get();
5760
5861 if (value->is_type(ATOM_SPACE))
5962 return AtomSpaceCast(value).get();
6063
64 if (0 == value->size())
65 return _target_as.get();
66
6167 ValuePtr vp(value);
6268 if (vp->is_type(ATOM))
6369 {
……@@ -66,12 +72,15 @@ AtomSpace* StorageNode::get_target_as(const ValuePtr& value) const
6672 vp = h->execute();
6773 }
6874
69 if (nullptr == vp or 0 == vp->size())
75 if (nullptr == vp)
7076 return _target_as.get();
7177
7278 if (vp->is_type(ATOM_SPACE))
7379 return AtomSpaceCast(vp).get();
7480
81 if (0 == vp->size())
82 return _target_as.get();
83
7584 throw RuntimeException(TRACE_INFO,
7685 "Expected AtomSpace; got %s", value->to_string().c_str());
7786}