graph-store: safely peek update-log

Safely returns a null when either the update-log does not exists, or it
is empty

Fixes #3976
This commit is contained in:
Liam Fitzgerald 2020-11-25 14:40:49 +10:00
parent 6bb62d802b
commit 88adb0033a
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -748,12 +748,14 @@
[%x %peek-update-log @ @ ~]
=/ =ship (slav %p i.t.t.path)
=/ =term i.t.t.t.path
=/ update-log=(unit update-log:store) (~(get by update-logs) [ship term])
?~ update-log [~ ~]
=/ result=(unit [time update:store])
(peek:orm-log:store u.update-log)
?~ result [~ ~]
``noun+!>([~ -.u.result])
=/ m-update-log=(unit update-log:store) (~(get by update-logs) [ship term])
:- ~ :- ~ :- %noun
!> ^- (unit time)
%+ biff m-update-log
|= =update-log:store
=/ result=(unit [=time =update:store])
(peek:orm-log:store update-log)
(bind result |=([=time update:store] time))
==
::
++ get-node