Skip to content

Commit

Permalink
fix(form): handling duplication failure when no form to rename
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
  • Loading branch information
btry committed Oct 29, 2021
1 parent 26d8352 commit 351a36d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,9 @@ public function duplicate(array $options = []) {
} catch (ImportFailureException $e) {
$forms = $linker->getObjectsByType(PluginFormcreatorForm::class);
$form = reset($forms);
if ($form === null) {
return false;
}
$form->update([
'id' => $form->getID(),
'name' => $form->fields['name'] . ' [' . __('Errored duplicate', 'formcreator') . ']',
Expand Down

0 comments on commit 351a36d

Please sign in to comment.