GlimmerLabs / MathOverImages

A language and ecosystems for doing math over abstract images.
GNU Lesser General Public License v3.0
4 stars 3 forks source link

/user/:username/images crashes if no images #24

Closed alexthemitchell closed 10 years ago

alexthemitchell commented 10 years ago

If you go to a user who has no images, jade crashes because it's trying to read the username property from the first image in the array, but the array is empty so there is none.

TypeError: /Users/alexmitchell/Development/MathOverImages/Site/public/views/imagesCompilation.jade:3 1| extends ./partials/framework 2| block title

3| title= images[0].username + " on MIST" 4| block extraMetas 5| block extraLinks 6| script(type='text/javascript' src='/js/ugly.mist.js')

Cannot read property 'username' of undefined at eval (eval at (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/jade/lib/jade.js:172:8), :20:67) at eval (eval at (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/jade/lib/jade.js:172:8), :623:21) at res (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/jade/lib/jade.js:173:38) at Object.exports.render (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/jade/lib/jade.js:269:10) at Object.exports.renderFile (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/jade/lib/jade.js:305:18) at View.exports.renderFile as engine at View.render (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/express/lib/view.js:76:8) at Function.app.render (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/express/lib/application.js:496:10) at ServerResponse.res.render (/Users/alexmitchell/Development/MathOverImages/Site/node_modules/express/lib/response.js:794:7) at /Users/alexmitchell/Development/MathOverImages/Site/functions/albums.js:35:7

victoriawt commented 10 years ago

Thanks, changed it to 'viewing' when in the function viewing:req.params.username