Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Fix null language code and no detected text bug #899

Merged
merged 3 commits into from
Nov 16, 2018

Conversation

bparrishMines
Copy link
Contributor

No description provided.

@@ -15,7 +15,7 @@ + (void)handleDetection:(FIRVisionImage *)image
[FLTFirebaseMlVisionPlugin handleError:error result:result];
return;
} else if (!visionText) {
result(@[]);
result(@{ @"text" : @"", @"blocks" : @[] });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dart side expects a Map<dynamic, dynamic> to return.

@@ -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]
Copy link
Contributor Author

@bparrishMines bparrishMines Nov 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A crash would occur if language.languageCode was nil or NULL. This is because they can't be added to an NSDictionary.

@bparrishMines bparrishMines merged commit 6e0664a into flutter:master Nov 16, 2018
@bparrishMines bparrishMines deleted the mlkit_fix branch January 3, 2019 20:35
andreidiaconu pushed a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
andreidiaconu added a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
julianscheel pushed a commit to jusst-engineering/plugins that referenced this pull request Mar 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants