I am receiving the error shown below and don't understand why. The application is modeled after the xdata music web application. I have included the code mentioned in the error.
I successfully login and when it attempts to open the main form, I get the error message. The code appears to be the same as that of the demo. How can I determine what is causing this?
Error Text
View.Renewals.Main.pas:58 Uncaught TypeError:
Cannot read property 'CreateNew$2' of null
at Object.Display (View.Renewals.Main.pas:58)
at ConnectProc (CertificateRenewalsWeb.dpr:26)
at OnSuccess (XData.Web.Connection.pas:215)
at LocalSuccess (XData.Web.Connection.pas:324)
at XMLHttpRequest.XhrLoad (XData.Web.Connection.pas:139)
Source from CertificateRenewalsWeb.dpr
procedure DisplayMainView;
procedure ConnectProc;
begin
if Assigned(viewRenewalsLogin) then
viewRenewalsLogin.Free;
TviewRenewalsMain.Display(@DisplayLoginView); // CALL DISPLAY
end;
begin
if not DMConnection.ApiConnection.Connected then
DMConnection.ApiConnection.Open(@ConnectProc)
else
ConnectProc; // LINE 26
end;
procedure DisplayLoginView(AMessage: string);
begin
AuthService.Logout;
DMConnection.ApiConnection.Connected := False;
if Assigned(viewRenewalsMain) then
viewRenewalsMain.Free;
TviewRenewalsLogin.Display(@DisplayMainView);
end;
Source from view.renewals.main
...
private
FLogoutType: TLogoutfProc;
...
class procedure TviewRenewalsMain.Display(LogoutProc: TLogoutProc);
begin
if Assigned(viewRenewalsMain) then
viewRenewalsMain.Free;
viewRenewalsMain := viewRenewalsMain.CreateNew;
viewRenewalsMain.FLogoutProc := LogoutProc; // LINE 58
end;