]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix occasional crash in detailed toot view
authorThibaut Girka <thib@sitedethib.com>
Fri, 15 Feb 2019 16:13:32 +0000 (17:13 +0100)
committerThibG <thib@sitedethib.com>
Fri, 15 Feb 2019 16:34:15 +0000 (17:34 +0100)
Port f9a338b473e181dd725f9185d09394624088efac to glitch-soc

app/javascript/flavours/glitch/components/status.js

index 51fee0eec517b50afb1ff3b27487722d0090f948..349f9c6cc485eddb269f4e022688c9e39723830c 100644 (file)
@@ -217,7 +217,7 @@ export default class Status extends ImmutablePureComponent {
       this.setState({ autoCollapsed: true });
     }
 
-    this.didShowCard  = !this.props.muted && !this.props.hidden && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
+    this.didShowCard  = !this.props.muted && !this.props.hidden && this.props.status && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
   }
 
   getSnapshotBeforeUpdate (prevProps, prevState) {
@@ -230,7 +230,7 @@ export default class Status extends ImmutablePureComponent {
 
   //  Hack to fix timeline jumps on second rendering when auto-collapsing
   componentDidUpdate (prevProps, prevState, snapshot) {
-    const doShowCard  = !this.props.muted && !this.props.hidden && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
+    const doShowCard  = !this.props.muted && !this.props.hidden && this.props.status && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
     if (this.state.autoCollapsed || (doShowCard && !this.didShowCard)) {
       if (doShowCard) this.didShowCard = true;
       if (this.state.autoCollapsed) this.setState({ autoCollapsed: false });