1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-03-11 21:38:38 +01:00

fix bug when opt is null

This commit is contained in:
Enrico Fasoli 2015-11-18 01:55:31 +01:00
parent f132d5ae43
commit 6ef1e7d3e0

View File

@ -12,8 +12,9 @@ var opt, s = localStorage.getItem('ipfs-boards-settings')
try {
opt = JSON.parse(s)
} catch(e){
opt = { addr: 'localhost', port: 5001 }
// Do nothing
}
if(opt === null || opt === undefined) opt = { addr: 'localhost', port: 5001 }
var ipfs = require('ipfs-api')(opt.addr || 'localhost',opt.port || 5001)
var boards = new BoardsAPI(ipfs)