Skip to content

Commit

Permalink
Null value fix for startup screen validation
Browse files Browse the repository at this point in the history
  • Loading branch information
m4heshd committed Jun 1, 2018
1 parent b555e6f commit cf81bc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
16 changes: 8 additions & 8 deletions app/data/config.db
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{"type":"win-state","maxed":false,"position":[372,72],"size":[1226,845],"_id":"0"}
{"type":"win-state","maxed":false,"position":[262,25],"size":[1280,984],"_id":"0"}
{"type":"trackers","url":"https://newtrackon.com/api/stable","trackers":["http://tracker.tfile.me:80/announce","udp://tracker.torrent.eu.org:451/announce","udp://thetracker.org:80/announce","http://torrent.nwps.ws:80/announce","http://alpha.torrenttracker.nl:443/announce","http://0d.kebhana.mx:443/announce","udp://bt.xxx-tracker.com:2710/announce","udp://inferno.demonoid.pw:3418/announce","udp://tracker.justseed.it:1337/announce","udp://tracker.vanitycore.co:6969/announce","udp://open.stealth.si:80/announce","udp://tracker.coppersurfer.tk:6969/announce","udp://tracker.opentrackr.org:1337/announce","udp://tracker.cypherpunks.ru:6969/announce","udp://tracker.tiny-vps.com:6969/announce","http://retracker.mgts.by:80/announce","udp://retracker.lanta-net.ru:2710/announce","udp://public.popcorn-tracker.org:6969/announce","http://tracker.skyts.net:6969/announce","udp://ipv4.tracker.harry.lu:80/announce","http://tracker.city9x.com:2710/announce","udp://tracker.martlet.tk:6969/announce","http://retracker.telecom.by:80/announce","udp://9.rarbg.com:2710/announce"],"_id":"1"}
{"type":"search","rs_count":100,"smart":true,"inst":false,"useAC":false,"history":[],"_id":"2"}
{"type":"dump","updURL":"http://127.0.0.1/tpb/torrent_dump_full.csv.gz","updLast":"2018-04-23T16:44:44.000Z","updType":"off","updInt":20,"keepDL":true,"updStat":["complete","",""],"_id":"3"}
{"type":"gen","sysTray":false,"logToFile":false,"useDHT":true,"supMsg":"2018-05-24T19:09:11.635Z","confVer":"1.0","_id":"4"}
{"type":"etc","thmURL":"https://www.google.com/search?q=OfflineBay%20themes","appUpdURL":"https://raw.githubusercontent.com/techtacoriginal/ob_release/master/release.json","_id":"5"}
{"type":"win-state","maxed":false,"position":[362,77],"size":[1240,826],"_id":"0"}
{"type":"win-state","maxed":false,"position":[362,77],"size":[1240,826],"_id":"0"}
{"type":"search","rs_count":100,"smart":true,"inst":false,"useAC":false,"history":[],"_id":"2"}
{"type":"search","rs_count":100,"smart":true,"inst":false,"useAC":true,"history":[],"_id":"2"}
{"type":"dump","updURL":"https://thepiratebay.org/static/dump/csv/torrent_dump_full.csv.gz","updLast":"2003-01-01T00:00:00.000Z","updType":"notify","updInt":10,"keepDL":true,"updStat":["complete","",""],"_id":"3"}
{"type":"gen","sysTray":true,"logToFile":true,"useDHT":true,"supMsg":"2018-06-01T05:03:08.261Z","confVer":"1.0","_id":"4"}
{"type":"etc","thmURL":"https://github.com/techtacoriginal/offlinebay-themes","appUpdURL":"https://raw.githubusercontent.com/techtacoriginal/ob_release/master/release.json","_id":"5"}
{"type":"win-state","maxed":false,"position":[262,25],"size":[1280,984],"_id":"0"}
{"type":"win-state","maxed":false,"position":[262,25],"size":[1280,984],"_id":"0"}
{"type":"search","rs_count":100,"smart":true,"inst":false,"useAC":true,"history":[],"_id":"2"}
8 changes: 7 additions & 1 deletion app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,13 @@ function showSplash() {

// Create the main window and handle events
function startOB() {
let curScreen = electron.screen.getDisplayNearestPoint({x: prefs.position[0], y: prefs.position[1]});
let curScreen;

if (prefs.position[0] !== null && prefs.position[1] !== null) {
curScreen = electron.screen.getDisplayNearestPoint({x: prefs.position[0], y: prefs.position[1]});
} else {
curScreen = electron.screen.getPrimaryDisplay();
}

if (prefs.size[0] > curScreen.workAreaSize.width) {
prefs.size[0] = curScreen.workAreaSize.width;
Expand Down

0 comments on commit cf81bc2

Please sign in to comment.