Skip to content

Commit

Permalink
fix(KeyApi.RemoveAsync): handle null Keys resuly #41
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed Nov 1, 2018
1 parent 87c1898 commit f3e6e6c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/CoreApi/KeyApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public async Task<IEnumerable<IKey>> ListAsync(CancellationToken cancel = defaul
public async Task<IKey> RemoveAsync(string name, CancellationToken cancel = default(CancellationToken))
{
var json = await ipfs.DoCommandAsync("key/rm", cancel, name);
var keys = (JArray)(JObject.Parse(json)["Keys"]);
return keys
var keys = JObject.Parse(json)["Keys"] as JArray;

return keys?
.Select(k => new KeyInfo
{
Id = (string)k["Id"],
Expand Down

0 comments on commit f3e6e6c

Please sign in to comment.