cancel
Showing results for 
Search instead for 
Did you mean: 

pointer to model is null

Professional
Senior

Hello

i want to pass variable value from model to view.

Model has get function

uint8_t Model::getLanguage()

{

   return (md_language);

}

Presenter also :

uint8_t LanguagePresenter::getLanguage()

{

   return(model->getLanguage());

}

LanguageView::LanguageView()

{

selected_language = presenter->getLanguage();

}

when Presenter function is executed i have an exception : the model pointer is null.

If i put breakpoint i can see model object is created before presenter and view.

Why model pointer is null in prsenter function ?

I can we get data from model ?

thanks

regards

2 REPLIES 2
Martin KJELDSEN
Chief III

Hi @Professional​,

The model pointer should definitely not be null. It is configured for the presenter whenever you transition to a new screen, automatically. Your approach seems correct. You should be able to get things from the model through the presenter, from the view.

Which compiler/project are you using? Is this an issue with both simulator and target project?

Thanks!

Best regards,

Martin

Professional
Senior

Hello

thanks for your reply

i' m using only simulator just for now (visual studio 2017 C++).

i've solved the problem by calling presenter->getLanguage(); from setupScreen() function instead of view constructor LanguageView::LanguageView()

best regards