File tree Expand file tree Collapse file tree
packages/react-native-executorch/src/modules/computer_vision Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ export class ClassificationModule extends BaseModule {
2828 model . modelSource
2929 ) ;
3030
31- if ( paths === null || paths . length < 1 ) {
31+ if ( paths === null || paths . length < 1 || paths [ 0 ] === undefined ) {
3232 throw new RnExecutorchError (
3333 RnExecutorchErrorCode . DownloadInterrupted ,
3434 'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
3535 ) ;
3636 }
3737
38- this . nativeModule = global . loadClassification ( paths [ 0 ] || '' ) ;
38+ this . nativeModule = global . loadClassification ( paths [ 0 ] ) ;
3939 } catch ( error ) {
4040 Logger . error ( 'Load failed:' , error ) ;
4141 throw parseUnknownError ( error ) ;
Original file line number Diff line number Diff line change @@ -27,14 +27,14 @@ export class ImageEmbeddingsModule extends BaseModule {
2727 model . modelSource
2828 ) ;
2929
30- if ( paths === null || paths . length < 1 ) {
30+ if ( paths === null || paths . length < 1 || paths [ 0 ] === undefined ) {
3131 throw new RnExecutorchError (
3232 RnExecutorchErrorCode . DownloadInterrupted ,
3333 'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
3434 ) ;
3535 }
3636
37- this . nativeModule = global . loadImageEmbeddings ( paths [ 0 ] || '' ) ;
37+ this . nativeModule = global . loadImageEmbeddings ( paths [ 0 ] ) ;
3838 } catch ( error ) {
3939 Logger . error ( 'Load failed:' , error ) ;
4040 throw parseUnknownError ( error ) ;
Original file line number Diff line number Diff line change @@ -29,14 +29,14 @@ export class ImageSegmentationModule extends BaseModule {
2929 model . modelSource
3030 ) ;
3131
32- if ( paths === null || paths . length < 1 ) {
32+ if ( paths === null || paths . length < 1 || paths [ 0 ] === undefined ) {
3333 throw new RnExecutorchError (
3434 RnExecutorchErrorCode . DownloadInterrupted ,
3535 'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
3636 ) ;
3737 }
3838
39- this . nativeModule = global . loadImageSegmentation ( paths [ 0 ] || '' ) ;
39+ this . nativeModule = global . loadImageSegmentation ( paths [ 0 ] ) ;
4040 } catch ( error ) {
4141 Logger . error ( 'Load failed:' , error ) ;
4242 throw parseUnknownError ( error ) ;
Original file line number Diff line number Diff line change @@ -29,14 +29,14 @@ export class ObjectDetectionModule extends BaseModule {
2929 model . modelSource
3030 ) ;
3131
32- if ( paths === null || paths . length < 1 ) {
32+ if ( paths === null || paths . length < 1 || paths [ 0 ] === undefined ) {
3333 throw new RnExecutorchError (
3434 RnExecutorchErrorCode . DownloadInterrupted ,
3535 'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
3636 ) ;
3737 }
3838
39- this . nativeModule = global . loadObjectDetection ( paths [ 0 ] || '' ) ;
39+ this . nativeModule = global . loadObjectDetection ( paths [ 0 ] ) ;
4040 } catch ( error ) {
4141 Logger . error ( 'Load failed:' , error ) ;
4242 throw parseUnknownError ( error ) ;
Original file line number Diff line number Diff line change @@ -28,14 +28,14 @@ export class StyleTransferModule extends BaseModule {
2828 model . modelSource
2929 ) ;
3030
31- if ( paths === null || paths . length < 1 ) {
31+ if ( paths === null || paths . length < 1 || paths [ 0 ] === undefined ) {
3232 throw new RnExecutorchError (
3333 RnExecutorchErrorCode . DownloadInterrupted ,
3434 'The download has been interrupted. As a result, not every file was downloaded. Please retry the download.'
3535 ) ;
3636 }
3737
38- this . nativeModule = global . loadStyleTransfer ( paths [ 0 ] || '' ) ;
38+ this . nativeModule = global . loadStyleTransfer ( paths [ 0 ] ) ;
3939 } catch ( error ) {
4040 Logger . error ( 'Load failed:' , error ) ;
4141 throw parseUnknownError ( error ) ;
You can’t perform that action at this time.
0 commit comments