Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

Commit

Permalink
Handle empty current
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Lind committed Jun 6, 2015
1 parent 979af5a commit 3c1b7a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/Grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ global.processes = {}

exports.getTasks = function () {
return new Promise(function (resolve, reject) {
fs.readFile(path.join(window.localStorage.getItem('current'), 'Gruntfile.js'), function (err, gruntfile) {
let current = window.localStorage.getItem('current')

if (!current) return resolve([])

fs.readFile(path.join(current, 'Gruntfile.js'), function (err, gruntfile) {
if (err) return resolve([])

grunt.init(gruntfile)
Expand Down
2 changes: 1 addition & 1 deletion src/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void (function () {

function build () {
trayMenu.append(new MenuItem({
label: window.localStorage.getItem('current'),
label: window.localStorage.getItem('current') || 'Choose folder...',
click: function () {
dialog.showOpenDialog({ properties: ['openDirectory']}, function (dir) {
if (dir !== undefined) {
Expand Down

0 comments on commit 3c1b7a9

Please sign in to comment.