Skip to content

Commit

Permalink
this prevents a crash when image answer is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
scytacki committed Jul 8, 2024
1 parent 7fabd7b commit a695683
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/components/portal-dashboard/answers/image-answer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const ImageAnswer: React.FC<IProps> = (props) => {
const imgWidth = aspectRatio > 0 ? (constrainX ? containerWidth : containerHeight / aspectRatio) : 0;
const imgHeight = aspectRatio > 0 ? (constrainX ? containerWidth / aspectRatio : containerHeight) : 0;

if (!imgAnswer) {
if (!imgAnswer || typeof imgAnswer.get !== "function") {
// There are broken answer documents that do not include an answer field
// Don't crash, just provide a error message to the teacher
// This needs to happen after all of the useState calls otherwise React will get
Expand Down

0 comments on commit a695683

Please sign in to comment.