@@ -86,9 +86,9 @@ module.exports = {
8686 // TODO: Check that `node[3]` is the node we need
8787 if ( node [ 0 ] !== 'declaration' || ! node [ 3 ] || ! node [ 3 ] )
8888 return ;
89- if ( node [ 3 ] [ 2 ] [ 0 ] === 'ident' )
89+ if ( node [ 3 ] [ 2 ] && node [ 3 ] [ 2 ] [ 0 ] === 'ident' )
9090 return node [ 3 ] [ 2 ] [ 1 ] ;
91- if ( node [ 3 ] [ 2 ] [ 0 ] === 'function' )
91+ if ( node [ 3 ] [ 2 ] && node [ 3 ] [ 2 ] [ 0 ] === 'function' )
9292 return node [ 3 ] [ 2 ] [ 1 ] [ 1 ] ;
9393 } ,
9494
@@ -236,13 +236,17 @@ module.exports = {
236236
237237 // Gathering Info
238238 this . _walk ( node , this . _getDeclName , function ( info , i ) {
239- var sum = node [ i - 1 ] [ 1 ] . replace ( / ^ [ \t ] * \n + / , '' ) . length + info . prefixLength ;
240- getResult ( node , sum , info , i ) ;
239+ if ( node [ i - 1 ] ) {
240+ var sum = node [ i - 1 ] [ 1 ] . replace ( / ^ [ \t ] * \n + / , '' ) . length + info . prefixLength ;
241+ getResult ( node , sum , info , i ) ;
242+ }
241243 } ) ;
242244
243245 this . _walk ( node , this . _getValName , function ( info , i ) {
244- var sum = node [ i ] [ 3 ] [ 1 ] [ 1 ] . replace ( / ^ [ \t ] * \n + / , '' ) . length + info . prefixLength ;
245- getResult ( node , sum , info , i ) ;
246+ if ( node [ i ] [ 3 ] [ 1 ] ) {
247+ var sum = node [ i ] [ 3 ] [ 1 ] [ 1 ] . replace ( / ^ [ \t ] * \n + / , '' ) . length + info . prefixLength ;
248+ getResult ( node , sum , info , i ) ;
249+ }
246250 } ) ;
247251
248252 if ( result . true > 0 || result . false > 0 ) {
0 commit comments