Skip to content

Commit

Permalink
Fix crash when preferences are deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsbfft committed Dec 5, 2016
1 parent 499bece commit 63f8d9e
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/js/main/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,30 @@ function User(name, factory) {
}.bind(this));

// @if NODE_ENV='development'
c.log('[User] Preference model v. ' + this.preferences['model_version']);
if(this.preferences) { c.log('[User] Preference model v. ' + this.preferences['model_version']); }
// @endif

if(this.preferences['model_version'] !== app.getVersion()) {
// @if NODE_ENV='development'
c.log('[User] Using a different model. Latest is ' + app.getVersion());
// @endif

dialog.showMessageBox(
{
type: 'info',
message: 'Preference model outdated.',
detail: 'Reset the preferences to use new features.',
buttons: ['Reset', 'Continue Anyway'],
defaultId: 0
},
function(buttonId) {
if(this.preferences) {
if(this.preferences['model_version'] !== app.getVersion()) {
// @if NODE_ENV='development'
c.log('[User] Using a different model. Latest is ' + app.getVersion());
// @endif

if(buttonId == 0) UserManager.reset('Preferences', 'oryoki-preferences.json', 'factory.json');
dialog.showMessageBox(
{
type: 'info',
message: 'Preference model outdated.',
detail: 'Reset the preferences to use new features.',
buttons: ['Reset', 'Continue Anyway'],
defaultId: 0
},
function(buttonId) {

}.bind(this)
);
if(buttonId == 0) UserManager.reset('Preferences', 'oryoki-preferences.json', 'factory.json');

}.bind(this)
);
}
}

// Init conf file
Expand Down

0 comments on commit 63f8d9e

Please sign in to comment.