diff --git a/run.sh b/run.sh
index 13435e8147c1d0f31303d4337edf02f9f9bc1e9b..51e36ce45db4161725f354d5520d547d73470ade 100755
--- a/run.sh
+++ b/run.sh
@@ -55,6 +55,16 @@ function main () {
         echo "input_dir: ${input_dir}"
         echo "output_dir: ${output_dir}"
 
+        # Validate passed args.
+        if [[ "${flags[@]}" =~ "no-sort" && "${input_dir}" == "${output_dir}" ]]
+        then
+            # Flag "no-sort" set, but input and output directories are the same.
+            echo -e "${text_red}Invalid parameter combination.${text_reset}"
+            echo -e "${text_red}Input and output directories are the same, but \"no-sort\" flag is set.${text_reset}"
+            exit 1
+        fi
+
+
         # Loop through all files in input directory.
         for file in ${input_dir}/*
         do