Fix crash on channels without topic

pull/26/head
Oleksii Holub 7 years ago
parent 6ccba43807
commit 7da82f9ef4

@ -52,7 +52,7 @@ namespace DiscordChatExporter.Services
// Get basic data
var id = token["id"].Value<string>();
var type = (ChannelType) token["type"].Value<int>();
var topic = token["topic"].Value<string>();
var topic = token["topic"]?.Value<string>();
// Extract name based on type
string name;
@ -74,7 +74,7 @@ namespace DiscordChatExporter.Services
// Get basic data
var id = token["id"].Value<string>();
var timeStamp = token["timestamp"].Value<DateTime>();
var editedTimeStamp = token["edited_timestamp"].Value<DateTime?>();
var editedTimeStamp = token["edited_timestamp"]?.Value<DateTime?>();
var content = token["content"].Value<string>();
var type = (MessageType) token["type"].Value<int>();

Loading…
Cancel
Save