diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt
index 5fe6a9152d..46fc1559d8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/csv-profiles.tt
@@ -199,15 +199,19 @@ function reloadPage(p) {
[% IF op == 'delete_confirm' %]
-
Delete CSV Profile "[% csv_profile.profile %]?"
-
-
+ [% IF csv_profile %]
+ Delete CSV Profile "[% csv_profile.profile %]?"
+
+
+ [% ELSE %]
+ This CSV Profile does not exist.
+ [% END %]
[% END %]
diff --git a/tools/csv-profiles.pl b/tools/csv-profiles.pl
index 7db0f67417..a9b8525fa9 100755
--- a/tools/csv-profiles.pl
+++ b/tools/csv-profiles.pl
@@ -82,7 +82,8 @@ if ( $op eq 'add_form' ) {
my $encoding = $input->param("encoding");
if ($export_format_id) {
- my $csv_profile = Koha::CsvProfiles->find($export_format_id);
+ my $csv_profile = Koha::CsvProfiles->find($export_format_id)
+ or die "Something went wrong! This export_format_id does not match any existing CSV profile.";
$csv_profile->profile($profile);
$csv_profile->description($description);
$csv_profile->content($content);