When I add an entity and clone from an unknown id like

drupal.site/node/add/page?fieldclone=node:19:field_foo

where node id 19 does not exist I get an unexpected error::

The website encountered an unexpected error. Please try again later.
Error: Call to a member function bundle() on null in Drupal\fieldclone\Helper::parse() (line 136 of modules/fieldclone/src/Helper.php).

In case the field name us not existing there will be a normal message alert.

Query parameter fieldclone: bundle page does not have target field field_foo.

Comments

demonde created an issue. See original summary.

bkhandruk’s picture

Status: Active » Needs review
StatusFileSize
new823 bytes

Fixed by placing bundle method usage after a check for source entity.

demonde’s picture

Works nice.

geek-merlin’s picture

Status: Needs review » Closed (outdated)

Code has significantly changed, and it looks like this is not an issue anymore. Feel free to reopen if still.