Skip to content

Commit 38fea9f

Browse files
committed
fix: null checking
1 parent b041baa commit 38fea9f

File tree

1 file changed

+7
-2
lines changed
  • src/shared/components/challenge-detail/Specification

1 file changed

+7
-2
lines changed

src/shared/components/challenge-detail/Specification/index.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ export default function ChallengeDetailsView(props) {
5959
forumId,
6060
} = legacy;
6161

62-
const allowStockArt = _.find(metadata, { name: 'allowStockArt' }).value;
62+
let stockArtValue = '';
63+
const allowStockArt = _.find(metadata, { name: 'allowStockArt' });
64+
if (allowStockArt) {
65+
stockArtValue = allowStockArt.value;
66+
}
67+
6368
let environment = '';
6469
const environmentData = _.find(metadata, { name: 'environment' });
6570
if (environmentData) {
@@ -103,7 +108,7 @@ export default function ChallengeDetailsView(props) {
103108
const toolbarConnector = new ToolbarConnector();
104109
const isSaving = specsTabState === SPECS_TAB_STATES.SAVING;
105110

106-
const stockArtText = allowStockArt
111+
const stockArtText = stockArtValue
107112
? 'Stock photography is allowed in this challenge.'
108113
: 'Stock photography is not allowed in this challenge. All submitted elements must be designed solely by you.';
109114

0 commit comments

Comments
 (0)