Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed exceptions when using fetchThreadInfo() #41

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fbchat-sharp/API/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ public async Task<Dictionary<string, FB_Thread>> fetchThreadInfo(List<string> th
var _id = entry.get("thread_key")?.get("thread_fbid").Value<string>();
rtn[_id] = FB_Group._from_graphql(_session, entry);
}
if (entry.get("thread_type")?.Value<string>()?.Equals("MARKETPLACE") ?? false)
else if (entry.get("thread_type")?.Value<string>()?.Equals("MARKETPLACE") ?? false)
{
var _id = entry.get("thread_key")?.get("thread_fbid").Value<string>();
rtn[_id] = FB_Marketplace._from_graphql(_session, entry);
Expand Down
12 changes: 6 additions & 6 deletions fbchat-sharp/API/Models/Plan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ internal static FB_Plan _from_graphql(JToken data, Session session)
{
FB_Plan rtn = new FB_Plan(
session: session,
time: data.get("time")?.Value<string>(),
title: data.get("event_title")?.Value<string>(),
location: data.get("location_name")?.Value<string>()
time: data?.get("time")?.Value<string>(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If data is null here something else is the issue

title: data?.get("event_title")?.Value<string>(),
location: data?.get("location_name")?.Value<string>()
);
rtn.uid = data.get("id")?.Value<string>();
rtn.author_id = data.get("lightweight_event_creator")?.get("id")?.Value<string>();
rtn.guests = data.get("event_reminder_members")?.get("edges")?.Select((x) => {
rtn.uid = data?.get("id")?.Value<string>();
rtn.author_id = data?.get("lightweight_event_creator")?.get("id")?.Value<string>();
rtn.guests = data?.get("event_reminder_members")?.get("edges")?.Select((x) => {
return new { Key = x.get("node")?.get("id") ?.Value<string>(), Value = FB_Plan_Constants.GUESTS[x.get("guest_list_state")?.Value<string>()] };
}).ToDictionary(t => t.Key, t => t.Value);
return rtn;
Expand Down