| … | … | @@ -50,14 +50,20 @@ StorageNode::~StorageNode() |
| 50 | 50 | { |
| 51 | 51 | } |
| 52 | 52 | |
| 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. |
| 53 | 56 | AtomSpace* StorageNode::get_target_as(const ValuePtr& value) const |
| 54 | 57 | { |
| 55 | | if (nullptr == value or 0 == value->size()) |
| 58 | if (nullptr == value) |
| 56 | 59 | return _target_as.get(); |
| 57 | 60 | |
| 58 | 61 | if (value->is_type(ATOM_SPACE)) |
| 59 | 62 | return AtomSpaceCast(value).get(); |
| 60 | 63 | |
| 64 | if (0 == value->size()) |
| 65 | return _target_as.get(); |
| 66 | |
| 61 | 67 | ValuePtr vp(value); |
| 62 | 68 | if (vp->is_type(ATOM)) |
| 63 | 69 | { |
| … | … | @@ -66,12 +72,15 @@ AtomSpace* StorageNode::get_target_as(const ValuePtr& value) const |
| 66 | 72 | vp = h->execute(); |
| 67 | 73 | } |
| 68 | 74 | |
| 69 | | if (nullptr == vp or 0 == vp->size()) |
| 75 | if (nullptr == vp) |
| 70 | 76 | return _target_as.get(); |
| 71 | 77 | |
| 72 | 78 | if (vp->is_type(ATOM_SPACE)) |
| 73 | 79 | return AtomSpaceCast(vp).get(); |
| 74 | 80 | |
| 81 | if (0 == vp->size()) |
| 82 | return _target_as.get(); |
| 83 | |
| 75 | 84 | throw RuntimeException(TRACE_INFO, |
| 76 | 85 | "Expected AtomSpace; got %s", value->to_string().c_str()); |
| 77 | 86 | } |