Skip to content

Commit

Permalink
conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfomiranda committed Jul 27, 2024
1 parent c65ee57 commit 60ce790
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/keri/app/credentialing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ export class Credentials {
// check if last event already has the anchor in it
// and avoid creating a new event if it does
const lastEvent = events[events.length - 1];
if (lastEvent.a.length == 1 &&
lastEvent.a[0].i == iss.i &&
lastEvent.a[0].s == iss.s &&
lastEvent.a[0].d == iss.d)
if (lastEvent.a?.length == 1 &&
lastEvent.a[0]?.i == iss.i &&
lastEvent.a[0]?.s == iss.s &&
lastEvent.a[0]?.d == iss.d)
{
sn = sn - 1; // revert sn
dig = hab.state.p!;
Expand Down Expand Up @@ -352,10 +352,10 @@ export class Credentials {
// check if last event already has the anchor in it
// and avoid creating a new event if it does
const lastEvent = events[events.length - 1];
if (lastEvent.a.length == 1 &&
lastEvent.a[0].i == rev.i &&
lastEvent.a[0].s == rev.s &&
lastEvent.a[0].d == rev.d)
if (lastEvent.a?.length == 1 &&
lastEvent.a[0]?.i == rev.i &&
lastEvent.a[0]?.s == rev.s &&
lastEvent.a[0]?.d == rev.d)
{
sn = sn - 1; // revert sn
dig = state.p!;
Expand Down Expand Up @@ -648,10 +648,10 @@ export class Registries {
// check if last event already has the anchor in it
// and avoid creating a new event if it does
const lastEvent = events[events.length - 1];
if (lastEvent.a.length == 1 &&
lastEvent.a[0].i == regser.pre &&
lastEvent.a[0].s == '0' &&
lastEvent.a[0].d == regser.pre)
if (lastEvent.a?.length == 1 &&
lastEvent.a[0]?.i == regser.pre &&
lastEvent.a[0]?.s == '0' &&
lastEvent.a[0]?.d == regser.pre)
{
sn = sn - 1; // revert sn
dig = state.p!;
Expand Down

0 comments on commit 60ce790

Please sign in to comment.