forked from MapComplete/MastodonBot
Add null protection
This commit is contained in:
parent
bef7fd95ce
commit
e897c3b4e8
3 changed files with 3 additions and 3 deletions
|
@ -16,7 +16,7 @@
|
|||
"scripts": {
|
||||
"build": "tsc",
|
||||
"lint": "tslint --project ./tsconfig.json -t stylish",
|
||||
"start": "nvm use && ts-node src/index.ts",
|
||||
"start": "ts-node src/index.ts",
|
||||
"test": "doctest-ts-improved src/ && mocha --require ts-node/register \"./**/*.doctest.ts\" && (find . -type f -name \"*.doctest.ts\" | xargs rm)"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -45,7 +45,7 @@ export default class OsmUserInfo {
|
|||
const div = document.createElement("div")
|
||||
div.innerHTML = userdata.description
|
||||
const links = Array.from(div.getElementsByTagName("a"))
|
||||
const meLinks = links.filter(link => link.getAttribute("rel").split(" ").indexOf("me") >= 0)
|
||||
const meLinks = links.filter(link => link.getAttribute("rel")?.split(" ")?.indexOf("me") >= 0)
|
||||
return meLinks.map(link => link.href.toString()) //*/
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,6 @@ export class Postbuilder {
|
|||
const props = image.changeset.properties
|
||||
const uid = ""+props.uid
|
||||
|
||||
|
||||
if (result.indexOf(image) >= 0) {
|
||||
continue
|
||||
}
|
||||
|
@ -200,6 +199,7 @@ export class Postbuilder {
|
|||
themeBonus[theme] = (themeBonus[theme] ?? 0) - 1
|
||||
const uid = randomBestImage.changeset.properties.uid
|
||||
alreadyEncounteredUid.set(uid, (alreadyEncounteredUid.get(uid) ?? 0) + 1)
|
||||
console.log("Selecting image",randomBestImage.image," by ", randomBestImage.changeset.properties.user+" with score "+bestImageScore)
|
||||
}
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in a new issue