justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

`GET /channels/:channel` body can contain `"mature": null` #551

Closed MinnDevelopment closed 8 years ago

MinnDevelopment commented 8 years ago

I was parsing channel objects and got a NullPointerException from the "mature" key. I previously check if the response contains "_id" to make sure it is a proper object

tmaneri commented 8 years ago

I'm going to go out on a limb and guess that null means that the user has not explicitly set whether or not their channel is mature or not, which true and false meaning that the channel has picked a setting.

Muddr commented 8 years ago

a lot of keys can have nulls. most defaults seems to be null unless otherwise set.

This is my bot that I never filled out the info for. https://api.twitch.tv/kraken/channels/muddbot/

MinnDevelopment commented 8 years ago

Yea I figured. I'm just checking for null for everything now. It should have a default value though. And hi muddr ;O

freaktechnik commented 8 years ago

See https://github.com/justintv/Twitch-API/blob/master/README.md#formats - twitch considers everything not specifically set as blank.