Skip to content

Commit

Permalink
Fix null language code and no detected text bug (flutter#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
bparrishMines authored Nov 16, 2018
1 parent 2847d7e commit 637ac55
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/firebase_ml_vision/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.0+2

* Fix bug with empty text object.
* Fix bug with crash from passing nil to map.

## 0.2.0+1

Bump Android dependencies to latest.
Expand Down
6 changes: 4 additions & 2 deletions packages/firebase_ml_vision/ios/Classes/TextRecognizer.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ + (void)handleDetection:(FIRVisionImage *)image
[FLTFirebaseMlVisionPlugin handleError:error result:result];
return;
} else if (!visionText) {
result(@[]);
result(@{ @"text" : @"", @"blocks" : @[] });
return;
}

Expand Down Expand Up @@ -85,7 +85,9 @@ + (void)addData:(NSMutableDictionary *)addTo

__block NSMutableArray<NSDictionary *> *allLanguageData = [NSMutableArray array];
for (FIRVisionTextRecognizedLanguage *language in languages) {
[allLanguageData addObject:@{@"languageCode" : language.languageCode}];
[allLanguageData addObject:@{
@"languageCode" : language.languageCode ? language.languageCode : [NSNull null]
}];
}

[addTo addEntriesFromDictionary:@{
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_ml_vision/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Flutter plugin for Google ML Vision for Firebase, an SDK that bring
learning expertise to Android and iOS apps in a powerful yet easy-to-use package.
author: Flutter Team <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/firebase_ml_vision
version: 0.2.0+1
version: 0.2.0+2

dependencies:
flutter:
Expand Down

0 comments on commit 637ac55

Please sign in to comment.