fix crash

This commit is contained in:
Laura Hausmann 2019-12-19 12:26:52 +01:00
parent 3f593517e1
commit 3a4cb9e025
Signed by: zotan
GPG key ID: 5EC1D38FFC321311

View file

@ -287,10 +287,8 @@ namespace telegram {
if (results.ChatIds.Length == 0)
return 0;
return results.ChatIds.Select(GetChat)
.Where(p => p.Type is ChatType.ChatTypePrivate)
.Select(p => ((ChatType.ChatTypePrivate) p.Type).UserId)
.First();
var output = results.ChatIds.Select(GetChat).Where(p => p.Type is ChatType.ChatTypePrivate).Select(p => ((ChatType.ChatTypePrivate) p.Type).UserId);
return output.Any() ? output.First() : 0;
}
public static int SearchContacts(string query) {