Explorar o código

Add reasonable default for flag lookup

Kirk Trombley %!s(int64=4) %!d(string=hai) anos
pai
achega
fc7516c2aa
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      client/src/domain/flagLookup.js

+ 3 - 0
client/src/domain/flagLookup.js

@@ -5,6 +5,9 @@ const asciiOffset = 0x41;
 const flagShift = flagOffset - asciiOffset;
 
 const flagLookup = country => {
+  if (country === null) {
+    return '🌎';
+  }
   const upper = country.toUpperCase();
   const firstChar = upper.charCodeAt(0) + flagShift;
   const secondChar = upper.charCodeAt(1) + flagShift;