workaround for null status

This commit is contained in:
Ondřej Hruška 2017-10-16 23:09:39 +02:00
parent 6cd5b3bbe5
commit 64a5e9a1de
No known key found for this signature in database
GPG Key ID: 2C5FD5035250423D
1 changed files with 10 additions and 0 deletions

View File

@ -102,6 +102,16 @@ const makeMapStateToProps = () => {
const mapStateToProps = (state, ownProps) => { const mapStateToProps = (state, ownProps) => {
let status = getStatus(state, ownProps.id); let status = getStatus(state, ownProps.id);
if(status === null) {
console.error(`ERROR! NULL STATUS! ${ownProps.id}`);
// work-around: find first good status
for (let k of state.get('statuses').keys()) {
status = getStatus(state, k);
if (status !== null) break;
}
}
let reblogStatus = status.get('reblog', null); let reblogStatus = status.get('reblog', null);
let account = undefined; let account = undefined;
let prepend = undefined; let prepend = undefined;