Skip to content

Commit

Permalink
widget/custom_variables: Fix variable save if name contains only numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed May 21, 2018
1 parent 5d1d31e commit 767d14d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/widgets/custom_variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ class CustomVariablesWidget {
})
socket.on('save.values', async (data, cb) => {
data.value = data.value.split(',').map((o) => o.trim()).filterNamedNodeMap(String).join(', ')
await global.db.engine.update('widgets.customVariables', { name: data.name }, { value: data.value })
await global.db.engine.update('widgets.customVariables', { name: String(data.name) }, { value: data.value })
global.api.setTitleAndGame(global.api, null) // update title
cb(null, data)
})
socket.on('load.variable', async (variable, callback) => {
variable = await global.db.engine.findOne('customvars', { key: variable })
variable = await global.db.engine.findOne('customvars', { key: String(variable) })
callback(null, variable) // { key: 'variable_name', 'value': 'current_value'}
})
socket.on('save.variable', async (data, cb) => {
await global.db.engine.update('customvars', { key: data.key }, { value: data.value })
await global.db.engine.update('customvars', { key: String(data.key) }, { value: data.value })
global.api.setTitleAndGame(global.api, null) // update title
cb(null, data)
})
Expand Down

0 comments on commit 767d14d

Please sign in to comment.