Skip to content

Commit 23924b1

Browse files
committed
chore: dont default do empty string in load method
1 parent 9f95d60 commit 23924b1

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

packages/react-native-executorch/src/modules/computer_vision/ClassificationModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

packages/react-native-executorch/src/modules/computer_vision/ImageEmbeddingsModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

packages/react-native-executorch/src/modules/computer_vision/ImageSegmentationModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

packages/react-native-executorch/src/modules/computer_vision/ObjectDetectionModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

packages/react-native-executorch/src/modules/computer_vision/StyleTransferModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)