Skip to content

Commit 5d412bf

Browse files
luacmartinsOSBotify
authored andcommitted
Merge pull request #43320 from Expensify/cmartins-fixCrashOnDistanceRate
(cherry picked from commit c44edc5)
1 parent d1edb23 commit 5d412bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/pages/workspace/distanceRates/PolicyDistanceRateDetailsPage.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ function PolicyDistanceRateDetailsPage({policy, route}: PolicyDistanceRateDetail
5151
const taxRateExternalID = rate.attributes?.taxRateExternalID;
5252

5353
const isDistanceTrackTaxEnabled = !!customUnit?.attributes?.taxEnabled;
54-
const taxRate = taxRateExternalID ? `${policy?.taxRates?.taxes[taxRateExternalID].name} (${policy?.taxRates?.taxes[taxRateExternalID].value})` : '';
54+
const taxRate =
55+
taxRateExternalID && policy?.taxRates?.taxes[taxRateExternalID] ? `${policy?.taxRates?.taxes[taxRateExternalID]?.name} (${policy?.taxRates?.taxes[taxRateExternalID]?.value})` : '';
5556
// Rates can be disabled or deleted as long as in the remaining rates there is always at least one enabled rate and there are no pending delete action
5657
const canDisableOrDeleteRate = Object.values(customUnit?.rates ?? {}).some(
5758
(distanceRate: Rate) => distanceRate?.enabled && rateID !== distanceRate?.customUnitRateID && distanceRate?.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,

0 commit comments

Comments
 (0)