Value error


#1

Hi there,

There is an error with Value class which is if you create a new Value passing 0 as parameter (i.e. a Value with integer 0), it crashes with assertion because of following lines:

Value::Value (ValueSource* const value_)
    : value (value_)
{
    jassert (value_ != nullptr);
}

Is that normal or can it be changed ?
Thanks and best regards


#2

Yes, it’s normal - I put that assertion there to stop you making the mistake that you’ve made!

Always check that a constructor actually exists before trying to use it! The Value class doesn’t take an integer, it takes a var, so pass it one of those instead.


#3

True !
My bad, sorry.