Browse Source

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 2 years ago
parent
commit
8e75563fd8
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/components/smart/EndpointsPage/EndpointsPage.tsx

+ 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,
         });
         });
       }
       }