Skip to content

Commit f3e6e6c

Browse files
fix(KeyApi.RemoveAsync): handle null Keys resuly #41
1 parent 87c1898 commit f3e6e6c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/CoreApi/KeyApi.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ internal KeyApi(IpfsClient ipfs)
6262
public async Task<IKey> RemoveAsync(string name, CancellationToken cancel = default(CancellationToken))
6363
{
6464
var json = await ipfs.DoCommandAsync("key/rm", cancel, name);
65-
var keys = (JArray)(JObject.Parse(json)["Keys"]);
66-
return keys
65+
var keys = JObject.Parse(json)["Keys"] as JArray;
66+
67+
return keys?
6768
.Select(k => new KeyInfo
6869
{
6970
Id = (string)k["Id"],

0 commit comments

Comments
 (0)