@@ -102,14 +102,14 @@ export class ImageSegmentation<
102102 const normMean = [ ...( preprocessorConfig ?. normMean ?? [ ] ) ] ;
103103 const normStd = [ ...( preprocessorConfig ?. normStd ?? [ ] ) ] ;
104104 const paths = await ResourceFetcher . fetch ( onDownloadProgress , modelSource ) ;
105- if ( paths === null || paths . length < 1 ) {
105+ if ( ! paths ?. [ 0 ] ) {
106106 throw new RnExecutorchError (
107107 RnExecutorchErrorCode . DownloadInterrupted ,
108108 'The download has been interrupted. Please retry.'
109109 ) ;
110110 }
111111 const nativeModule = global . loadImageSegmentation (
112- paths [ 0 ] || '' ,
112+ paths [ 0 ] ,
113113 normMean ,
114114 normStd
115115 ) ;
@@ -143,18 +143,12 @@ export class ImageSegmentation<
143143 onDownloadProgress : ( progress : number ) => void = ( ) => { }
144144 ) : Promise < ImageSegmentation < L > > {
145145 const paths = await ResourceFetcher . fetch ( onDownloadProgress , modelSource ) ;
146- if ( paths === null || paths . length < 1 ) {
146+ if ( ! paths ?. [ 0 ] ) {
147147 throw new RnExecutorchError (
148148 RnExecutorchErrorCode . DownloadInterrupted ,
149149 'The download has been interrupted. Please retry.'
150150 ) ;
151151 }
152- if ( ! paths [ 0 ] ) {
153- throw new RnExecutorchError (
154- RnExecutorchErrorCode . DownloadInterrupted ,
155- "The download couldn't be completed. Please retry."
156- ) ;
157- }
158152 const normMean = config . preprocessorConfig ?. normMean ?? [ ] ;
159153 const normStd = config . preprocessorConfig ?. normStd ?? [ ] ;
160154 const nativeModule = global . loadImageSegmentation (
0 commit comments