Skip to content

Commit 18f8076

Browse files
committed
Improve error handling of python envs
1 parent f8ec02c commit 18f8076

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/renderer/components/App.jsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ const App = ({helmetUIVersion, versions, searchEMMEPython}) => {
157157
setProjectPath(existingProjectPath);
158158
setBasedataPath(existingBasedataPath);
159159
setResultsPath(existingResultsPath);
160-
setEmmePythonEnvs(existingPythonEnvs);
160+
161+
if(Array.isArray(existingPythonEnvs)) {
162+
setEmmePythonEnvs(existingPythonEnvs);
163+
} else {
164+
setEmmePythonEnvs([]);
165+
}
161166

162167
//If Emme version is uninitialized, fetch version from config file
163168
if(existingEmmeVersion === undefined) {

src/renderer/components/Settings/Settings.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const Settings = ({
9090
closeEditing={() => setShowEmmeDialog(false)} /> }
9191
<div className="Settings__dialog-input-group">
9292
<span className="Settings__pseudo-label">Käytettävät Python-ympäristöt:</span>
93-
{ emmePythonEnvs && (emmePythonEnvs.map((env, index) => { return (
93+
{ Array.isArray(emmePythonEnvs) && emmePythonEnvs.length > 0 && (emmePythonEnvs.map((env, index) => { return (
9494
<div>
9595
<EnvironmentOption envPath={env} isSelected={emmePythonPath === env}
9696
setPath={setEMMEPythonPath}

0 commit comments

Comments
 (0)