Fix crashing if user does not have a feed list and tries to add a feed
This commit is contained in:
parent
2ec02130b0
commit
9ec788b71a
@ -68,14 +68,19 @@ async function feed(nick, setting, value) {
|
||||
consoleLog('[options.feed] '+nick+' is adding '+value)
|
||||
await testFeed(value);
|
||||
var file = editJsonFile('/home/node/app/config/usersettings.json');
|
||||
var feedsArr = uconfig[nick].feeds
|
||||
if (feedsArr.includes(value) == true) {
|
||||
errorMessage("null", "ALREADYEXISTS", value)
|
||||
} else {
|
||||
file.append(nick+".feeds", value);
|
||||
file.save();
|
||||
sendUpstream(value + ' added to your feed list')
|
||||
try {
|
||||
var feedsArr = uconfig[nick].feeds
|
||||
if (feedsArr.includes(value) == true) {
|
||||
errorMessage("null", "ALREADYEXISTS", value)
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
consoleLog('[options.feed] No user feed list in usersettings.json, it will be made')
|
||||
}
|
||||
file.append(nick+".feeds", value);
|
||||
file.save();
|
||||
sendUpstream(value + ' added to your feed list')
|
||||
|
||||
}
|
||||
if (setting === 'list') {
|
||||
content = [];
|
||||
|
Loading…
Reference in New Issue
Block a user