fix(FlowAppIcons): fix crash when no steps exist

This commit is contained in:
Ali BARIN
2024-08-29 08:24:53 +00:00
parent 59278378e5
commit d5c81c14f5

View File

@@ -4,7 +4,7 @@ import AppIcon from 'components/AppIcon';
import IntermediateStepCount from 'components/IntermediateStepCount'; import IntermediateStepCount from 'components/IntermediateStepCount';
function FlowAppIcons(props) { function FlowAppIcons(props) {
const { steps } = props; const { steps = [] } = props;
const stepsCount = steps.length; const stepsCount = steps.length;
const firstStep = steps[0]; const firstStep = steps[0];
const lastStep = steps.length > 1 && steps[stepsCount - 1]; const lastStep = steps.length > 1 && steps[stepsCount - 1];
@@ -14,7 +14,7 @@ function FlowAppIcons(props) {
<AppIcon <AppIcon
name=" " name=" "
variant="rounded" variant="rounded"
url={firstStep.iconUrl} url={firstStep?.iconUrl}
sx={{ width: 30, height: 30 }} sx={{ width: 30, height: 30 }}
/> />
@@ -26,7 +26,7 @@ function FlowAppIcons(props) {
<AppIcon <AppIcon
name=" " name=" "
variant="rounded" variant="rounded"
url={lastStep.iconUrl} url={lastStep?.iconUrl}
sx={{ width: 30, height: 30 }} sx={{ width: 30, height: 30 }}
/> />
)} )}