diff --git a/protected_forms.module b/protected_forms.module
index db83d58..a7fa42a 100644
--- a/protected_forms.module
+++ b/protected_forms.module
@@ -78,9 +78,11 @@ function _protected_forms_validate($form, &$form_state) {
 
   // Clean up $user_input from allowed patterns for further processing.
   $allowed_patterns = \Drupal::config('protected_forms.settings')->get('protected_forms.allowed_patterns');
-  $allowed_patterns = _string_to_array($allowed_patterns);
-  foreach($allowed_patterns as $allowed_pattern) {
-    $user_input = str_replace($allowed_pattern, '', $user_input);
+  if (!empty($allowed_patterns)) {
+    $allowed_patterns = _string_to_array($allowed_patterns);
+    foreach ($allowed_patterns as $allowed_pattern) {
+      $user_input = str_replace($allowed_pattern, '', $user_input);
+    }
   }
 
   /*
