Skip to content

Commit

Permalink
Merge pull request #22 from ML-Leonardo/fix/SAPMLCONV-6296-button-null
Browse files Browse the repository at this point in the history
Need to check if buttons is null before rendering the button html to …
  • Loading branch information
JWandrocke authored and GitHub Enterprise committed Jan 6, 2020
2 parents fe12d36 + e764e82 commit 7493550
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Message/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const Card = ({ content, sendMessage, onImageLoaded }) => {
if (imageUrl && sanitizeUrl(imageUrl) === 'about:blank') {
return null
}

// https://sapjira.wdf.sap.corp/browse/SAPMLCONV-6296
// Need to check if buttons is null before rendering the button html.
return (
<div className={'RecastAppCard CaiAppCard'}>
{imageUrl && <img src={imageUrl} onLoad={onImageLoaded} className='RecastAppCard--img CaiAppCard--img' />}
Expand All @@ -22,7 +23,7 @@ const Card = ({ content, sendMessage, onImageLoaded }) => {
{subtitle && <p className='Card--text-subtitle'>{truncate(subtitle, 80)}</p>}
</div>

{buttons.length ? (
{buttons && buttons.length ? (
<div className='RecastAppCard--button-container CaiAppCard--button-container'>
{buttons.slice(0, 3).map((b, i) => (
<Button key={i} button={b} sendMessage={sendMessage} />
Expand Down

0 comments on commit 7493550

Please sign in to comment.