Skip to content

empty opts if it doesn't exist to prevent crashing#16

Closed
ghost wants to merge 1 commit into
masterfrom
unknown repository
Closed

empty opts if it doesn't exist to prevent crashing#16
ghost wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Aug 29, 2014

Copy link
Copy Markdown

If there isn't a package.json, jadeify crashes because opts is null:

$ browserify -t jadeify rawr.js

/tmp/node_modules/jadeify/lib/jadeify.js:27
                opts.filename = fileName;
                              ^
TypeError: Cannot set property 'filename' of null
    at /tmp/node_modules/jadeify/lib/jadeify.js:27:31
    at /tmp/node_modules/jadeify/lib/jadeify.js:62:20
    at testDir (/tmp/node_modules/jadeify/node_modules/find-parent-dir/index.js:20:36)
    at /tmp/node_modules/jadeify/node_modules/find-parent-dir/index.js:26:7
    at Object.cb [as oncomplete] (fs.js:168:19)

This patch keeps jadeify from crashing.

@domenic

domenic commented Aug 29, 2014

Copy link
Copy Markdown
Owner

Something weird must be going on. How is that stack trace even possible? Line 62 does cb(err) but line 22 does will cause an early return if err is present, so line 27 should never be hit.

Setting up a test project to find dig further...

@domenic

domenic commented Aug 29, 2014

Copy link
Copy Markdown
Owner

Oh I misreadline 62. I see. I think the correct fix is cb(null, {}) on line 62 to be consistent with line 79.

@domenic domenic closed this in 8859e40 Aug 29, 2014
@domenic

domenic commented Aug 29, 2014

Copy link
Copy Markdown
Owner

Released as 2.5.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant