Something is causing the error, and you probably shouldn't just ignore it.
I would recommend switching to a debug (unminified) script and understand what kind of error it is.
As soon as you get an error, if you can't figure it out, post it on stackoverflow, and I'm sure someone can help you.
Try running custom scripts through jslint to see if there are any obvious problems. http://www.jslint.com
Change Based on your mistake, I would say that you are trying to do something with a null value, make sure you check for zeros in the code when it is possible that something can be null. You can set default values as follows:
variable = (typeof variable === undefined) ? defaultValueIfNull : variable;
or use the same check with if statements
if (typeof variable !== undefined) { //do stuff }
And since it is jquery, and it says the expected object, I would say that you can have a selector that does not return any matches, but these may be other things, this is just an assumption.
source share