Skip to content

Commit

Permalink
fix: invalid stage name handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceau committed Jun 23, 2021
1 parent d8d253b commit e2f21b1
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/renderer/containers/ReplayBrowser/ReplayFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,9 @@ export const ReplayFile: React.FC<ReplayFileProps> = ({
}) => {
const selected = selectedIndex !== -1;
const date = new Date(startTime ? Date.parse(startTime) : 0);
let stageName = "Unknown";
try {
if (settings.stageId !== null) {
stageName = stageUtils.getStageName(settings.stageId);
}
} catch (err) {
console.error(err);
}
const stageImageUrl = settings.stageId !== null ? getStageImage(settings.stageId) : undefined;
const stageInfo = settings.stageId !== null ? stageUtils.getStageInfo(settings.stageId) : null;
const stageImageUrl = stageInfo !== null && stageInfo.id !== -1 ? getStageImage(stageInfo.id) : undefined;
const stageName = stageInfo !== null ? stageInfo.name : "Unknown Stage";

return (
<div onClick={onClick} style={style}>
Expand Down

0 comments on commit e2f21b1

Please sign in to comment.