Ver código fonte

Fix endpoints page crash on no provider label

The endpoints page might crash if the provider label is not set. This
can happen depending on the order of the endpoints in the list. This
commit fixes the crash by checking for the label before trying to
render it.
Sergiu Miclea 3 anos atrás
pai
commit
8e75563fd8

+ 2 - 1
src/components/smart/EndpointsPage/EndpointsPage.tsx

@@ -94,7 +94,8 @@ class EndpointsPage extends React.Component<{ history: any }, State> {
     const providers = endpointStore.endpoints.reduce((p, endpoint) => {
     const providers = endpointStore.endpoints.reduce((p, endpoint) => {
       if (!p.find(p2 => p2.value === endpoint.type)) {
       if (!p.find(p2 => p2.value === endpoint.type)) {
         p.push({
         p.push({
-          label: configLoader.config.providerNames[endpoint.type],
+          label:
+            configLoader.config.providerNames[endpoint.type] || endpoint.type,
           value: endpoint.type,
           value: endpoint.type,
         });
         });
       }
       }