Skip to content

Commit

Permalink
Merge pull request #2173 from simianhacker/fix-2103
Browse files Browse the repository at this point in the history
Closes #2103 - Handling Rison exception for malformated urls
  • Loading branch information
w33ble committed Dec 9, 2014
2 parents ac297ac + e0537fc commit 6014a5c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/kibana/components/state_management/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ define(function (require) {
var applyDiff = require('utils/diff_object');
var qs = require('utils/query_string');

return function StateProvider(Private, $rootScope, $location) {
return function StateProvider(Notifier, Private, $rootScope, $location) {
var Events = Private(require('factories/events'));

_(State).inherits(Events);
Expand Down Expand Up @@ -40,7 +40,15 @@ define(function (require) {

State.prototype._readFromURL = function () {
var search = $location.search();
return search[this._urlParam] ? rison.decode(search[this._urlParam]) : null;
try {
return search[this._urlParam] ? rison.decode(search[this._urlParam]) : null;
} catch (e) {
var notify = new Notifier();
notify.error('Unable to parse URL');
search[this._urlParam] = rison.encode(this._defaults);
$location.search(search).replace();
return null;
}
};

/**
Expand Down

0 comments on commit 6014a5c

Please sign in to comment.