18257: Adds checks to array values thay may be null or undefined.
[arvados-workbench2.git] / src / views / run-process-panel / inputs / int-array-input.tsx
index 22c069b548fe18c6dd7d9c89e5012a19370017d1..8077f28a600342cf95b3e77cf0980a17a4b30d0c 100644 (file)
@@ -2,14 +2,14 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { isRequiredInput, IntArrayCommandInputParameter } from '~/models/workflow';
+import React from 'react';
+import { isRequiredInput, IntArrayCommandInputParameter } from 'models/workflow';
 import { Field } from 'redux-form';
-import { ERROR_MESSAGE } from '~/validators/require';
-import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
-import { ChipsInput } from '~/components/chips-input/chips-input';
+import { ERROR_MESSAGE } from 'validators/require';
+import { GenericInputProps, GenericInput } from 'views/run-process-panel/inputs/generic-input';
+import { ChipsInput } from 'components/chips-input/chips-input';
 import { createSelector } from 'reselect';
-import { IntInput } from '~/components/int-input/int-input';
+import { IntInput } from 'components/int-input/int-input';
 
 export interface IntArrayInputProps {
     input: IntArrayCommandInputParameter;
@@ -30,7 +30,7 @@ const validationSelector = createSelector(
 );
 
 const required = (value: string[]) =>
-    value.length > 0
+    value && value.length > 0
         ? undefined
         : ERROR_MESSAGE;
 
@@ -46,7 +46,7 @@ class InputComponent extends React.PureComponent<GenericInputProps>{
             deletable={!commandInput.disabled}
             orderable={!commandInput.disabled}
             disabled={commandInput.disabled}
-            value={input.value}
+            values={input.value}
             onChange={this.handleChange}
             createNewValue={value => parseInt(value, 10)}
             inputComponent={IntInput}