不要怂,就是干,撸起袖子干!

Commit 55156002 by Mick Hansen

fix(hooks): no longer crashes on hasHook when no hooks are defined, closes #3181

1 parent a65a3d6b
Showing with 2 additions and 1 deletions
# Next
- [BUG] Fixed support for 2 x belongsToMany without foreignKey defined and association getter/adder [#3185](https://github.com/sequelize/sequelize/issues/3185)
- [BUG] No longer throws on `Model.hasHook()` if no hooks are defiend [#3181](https://github.com/sequelize/sequelize/issues/3181)
# 2.0.3
- [BUG] Support for plain strings, ints and bools on JSON insert
......
......@@ -169,7 +169,7 @@ Hooks.addHook = function(hookType, name, fn) {
* @alias hasHooks
*/
Hooks.hasHook = function(hookType) {
return !!this.options.hooks[hookType].length;
return this.options.hooks[hookType] && !!this.options.hooks[hookType].length;
};
Hooks.hasHooks = Hooks.hasHook;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!