Skip to content

Commit

Permalink
[Fix] allow reading of resolved linked to events where event is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob committed Jun 29, 2016
1 parent 3f67317 commit acc4a1b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ClientMessageDtos.proto
Expand Up @@ -35,7 +35,7 @@ message EventRecord {
}

message ResolvedIndexedEvent {
required EventRecord event = 1;
optional EventRecord event = 1;
optional EventRecord link = 2;
}

Expand Down
8 changes: 5 additions & 3 deletions lib/connection.js
Expand Up @@ -509,10 +509,12 @@ function unpackResolvedEvent(resolvedEvent) {
if (!resolvedEvent) {
return null;
}
if (!resolvedEvent.event) {
throw new Error("Not a ResolvedEvent: " + resolvedEvent);

var unpackedEvent = {};
if (resolvedEvent.event) {
unpackedEvent = unpackEventRecord(resolvedEvent.event);
}
var unpackedEvent = unpackEventRecord(resolvedEvent.event);

if (resolvedEvent.link) unpackedEvent.link = unpackEventRecord(resolvedEvent.link);
return unpackedEvent;
}
Expand Down

0 comments on commit acc4a1b

Please sign in to comment.