Skip to content

Commit

Permalink
Fixed System.ArgumentException for Flow boards without pagination.
Browse files Browse the repository at this point in the history
Accessed JArray values with invalid key value: "fwd". Int32 array index expected.
  • Loading branch information
CXuesong committed Jul 30, 2018
1 parent 33f37a8 commit 70bae29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion WikiClientLibrary.Flow/Board.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ public IAsyncEnumerable<Topic> EnumTopicsAsync(TopicListingOptions options, int
var jresult = await Site.InvokeMediaWikiApiAsync(new MediaWikiFormRequestMessage(queryParams), ct);
var jtopiclist = (JObject)jresult["flow"]["view-topiclist"]["result"]["topiclist"];
await sink.YieldAndWait(Topic.FromJsonTopicList(Site, jtopiclist));
var nextPageUrl = (string)jtopiclist["links"]?["pagination"]?["fwd"]?["url"];
// 2018-07-30 flow.view-topiclist.result.topiclist.links.pagination is [] instead of null for boards without pagination.
var jpagination = jtopiclist["links"]?["pagination"];
var nextPageUrl = jpagination == null || jpagination is JArray
? null
: (string) jpagination["fwd"]?["url"];
if (nextPageUrl != null)
{
var urlParams = FlowUtility.ParseUrlQueryParametrs(nextPageUrl);
Expand Down

0 comments on commit 70bae29

Please sign in to comment.