Skip to main content
Professional
Associate III
January 14, 2019
Question

pointer to model is null

  • January 14, 2019
  • 2 replies
  • 745 views

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

This topic has been closed for replies.

2 replies

Martin KJELDSEN
Principal III
January 15, 2019

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
Associate III
January 15, 2019

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