diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java
index c7875cfead1..2193fcc1f4e 100644
--- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java
+++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java
@@ -96,6 +96,7 @@ private static List<Version> sortByPriority(List<String> versions) {
    * @see KubernetesVersionPriority
    */
   public static <T> List<T> sortByPriority(List<T> resources, Function<T, String> versionProvider) {
+    Utils.checkNotNull(versionProvider, "versionProvider function can't be null");
     if (resources == null || resources.isEmpty()) {
       return Collections.emptyList();
     }