fix: Some single-emoji names crashing

This commit is contained in:
Sorunome 2020-10-19 16:56:40 +02:00
parent 870d7f66fb
commit b29ebce717
No known key found for this signature in database
GPG key ID: B19471D07FC9BE9C

View file

@ -30,9 +30,9 @@ class Avatar extends StatelessWidget {
); );
final src = thumbnail; final src = thumbnail;
var fallbackLetters = '@'; var fallbackLetters = '@';
if ((name?.length ?? 0) >= 2) { if ((name?.runes?.length ?? 0) >= 2) {
fallbackLetters = String.fromCharCodes(name.runes, 0, 2); fallbackLetters = String.fromCharCodes(name.runes, 0, 2);
} else if ((name?.length ?? 0) == 1) { } else if ((name?.runes?.length ?? 0) == 1) {
fallbackLetters = name; fallbackLetters = name;
} }
final textWidget = Center( final textWidget = Center(