Don't crash when analyzing incomplete CREATE TABLE statement (#578)

This commit is contained in:
Simon Binder 2020-05-17 14:42:48 +02:00
parent 4d463dd145
commit 9bb83605e9
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
2 changed files with 6 additions and 1 deletions

View File

@ -35,6 +35,8 @@ class CreateTableReader {
span: stmt.tableNameToken.span, span: stmt.tableNameToken.span,
message: 'Could not extract schema information for this table: $e', message: 'Could not extract schema information for this table: $e',
)); ));
return null;
} }
final foundColumns = <String, MoorColumn>{}; final foundColumns = <String, MoorColumn>{};

View File

@ -63,7 +63,10 @@ class MoorParser {
} }
for (final reader in createdReaders) { for (final reader in createdReaders) {
createdEntities.add(await reader.extractTable(step.mapper)); final moorTable = await reader.extractTable(step.mapper);
if (moorTable != null) {
createdEntities.add(moorTable);
}
} }
final analyzedFile = ParsedMoorFile( final analyzedFile = ParsedMoorFile(