Aurelien354 / BadgerFilm

EPMA thin film analysis and more.
8 stars 2 forks source link

NullReferenceException when calculating offline #2

Closed yueyinqiu closed 2 years ago

yueyinqiu commented 2 years ago

NullReferenceException will occur after pressing Calculate button if it's running offline (actually it's not offline but can not link to google).

I know nothing about the project but there was someone who asked me about this, so I checked the code and found this at the end of sub Form1.Form1_Load(Object, EventArgs):

If HaveInternetConnection() = False Then Exit Sub

Dim version_check As String = Nothing
update_get_version(version_check)
'If version_check = "" Then Exit Sub
If compare_version(version_check, VERSION) Then
    Label1.Text = "Status:  New version available (" & version_check & ")" '. Please click the Update button to download the latest version."
End If

init_atomic_parameters(pen_path, eadl_path, ffast_path, at_data, el_ion_xs, ph_ion_xs, MAC_data_PEN14, MAC_data_PEN18, MAC_data_FFAST, options)

init_Ec(Ec_data, pen_path)

init_atomic_parameters and init_Ec won't be invoked if HaveInternetConnection() = False. I think this could be a mistake.

Aurelien354 commented 2 years ago

Thank you for finding this mistake. init_atomic_parametersand init_Ec are now called before HaveInternetConnection.