Skip to content

Commit

Permalink
Use a stricter assertion predicate to detect page id change.
Browse files Browse the repository at this point in the history
  • Loading branch information
CXuesong committed Nov 11, 2016
1 parent 0830984 commit eba69ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions WikiClientLibrary/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,9 @@ internal void LoadFromJson(JProperty prop, PageQueryOptions options)
var id = Convert.ToInt32(prop.Name);
// I'm not sure whether this assertion holds.
Debug.Assert(id != 0);
// The page has been overwritten, or deleted.
if (Id != 0 && !AreIdEquals(Id, id))
if ((options & PageQueryOptions.ResolveRedirects) != PageQueryOptions.ResolveRedirects
&& Id != 0 && !AreIdEquals(Id, id))
// The page has been overwritten, or deleted.
WikiClient.Logger?.Warn($"Detected change of page id: {Title}, {Id}");
Id = id;
var page = (JObject) prop.Value;
Expand Down

0 comments on commit eba69ed

Please sign in to comment.