Skip to content

Commit

Permalink
fixed crash for deleted migration classes
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Nov 11, 2014
1 parent 7c4e7d3 commit b429f63
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/MigrationExecution/MigrationExecutionService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,20 @@ bool MigrationExecutionService::execute(const QString &migrationName,
const MigrationExecutionConfig &migrationConfig = migrationContext.migrationConfig();
CommandExecution::CommandExecutionContext context(database, migrationConfig, migrationContext.helperRepository());
CommandPtrList undoCommands;
if(migrationName.isEmpty()) {
if (migrationName.isEmpty()) {
::qWarning() << LOG_PREFIX << "migrationName is empty";
return false;
}

CommandPtrList migrationCommands = migrationContext.migrationMap()[migrationName]->commandList();
if( migrationCommands.isEmpty() ) {
::qWarning() << LOG_PREFIX << "no comands for migration";
const Migrations::Migration* migration = migrationContext.migrationMap()[migrationName];
if (!migration) {
::qWarning() << LOG_PREFIX << "migration is missing: " << migrationName;
return false;
}

CommandPtrList migrationCommands = migration->commandList();
if (migrationCommands.isEmpty()) {
::qWarning() << LOG_PREFIX << "no commands for migration";
return false;
}

Expand All @@ -102,7 +108,7 @@ bool MigrationExecutionService::execute(const QString &migrationName,
}

MigrationTableServicePtr migrationTableService = migrationContext.baseMigrationTableService();
if(!migrationTableService) {
if (!migrationTableService) {
::qDebug() << LOG_PREFIX << Q_FUNC_INFO << "migrationTableService is 0";
return false;
}
Expand Down

0 comments on commit b429f63

Please sign in to comment.