{"record":{"id":"db32e80348fdb3d2","repo":"didi/DoKit","slug":"transformation-list-must-not-be-null","errorCode":null,"errorMessage":"Transformation list must not be null.","messagePattern":"Transformation list must not be null\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/Request.java","lineNumber":446,"sourceCode":"      }\n      if (transformation.key() == null) {\n        throw new IllegalArgumentException(\"Transformation key must not be null.\");\n      }\n      if (transformations == null) {\n        transformations = new ArrayList<com.didichuxing.doraemonkit.picasso.Transformation>(2);\n      }\n      transformations.add(transformation);\n      return this;\n    }\n\n    /**\n     * Add a list of custom transformations to be applied to the image.\n     * <p>\n     * Custom transformations will always be run after the built-in transformations.\n     */\n    public Builder transform(List<? extends Transformation> transformations) {\n      if (transformations == null) {\n        throw new IllegalArgumentException(\"Transformation list must not be null.\");\n      }\n      for (int i = 0, size = transformations.size(); i < size; i++) {\n        transform(transformations.get(i));\n      }\n      return this;\n    }\n\n    /** Create the immutable {@link Request} object. */\n    public Request build() {\n      if (centerInside && centerCrop) {\n        throw new IllegalStateException(\"Center crop and center inside can not be used together.\");\n      }\n      if (centerCrop && (targetWidth == 0 && targetHeight == 0)) {\n        throw new IllegalStateException(\n            \"Center crop requires calling resize with positive width and height.\");\n      }\n      if (centerInside && (targetWidth == 0 && targetHeight == 0)) {\n        throw new IllegalStateException(","sourceCodeStart":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/didi/DoKit/blob/626827cddb2feb2f3aee87a52a064b4e5ca2bed4/Android/dokit/src/main/java/com/didichuxing/doraemonkit/picasso/Request.java#L428-L464","documentation":"Thrown by the list overload of Request.Builder.transform(List<? extends Transformation>) when the list argument is null. Picasso rejects the null list up front (the per-element transform(Transformation) overload separately validates each entry).","triggerScenarios":"Calling transform((List<Transformation>) null), or transform(buildTransforms()) where buildTransforms() returned null.","commonSituations":"A helper that returns null instead of an empty list when no transformations apply; Java varargs passing a null array; Kotlin code passing a nullable List<Transformation>! from Java interop.","solutions":["Return Collections.emptyList() instead of null from transformation-builder helpers.","Null-check or default the list before calling: transform(list != null ? list : Collections.emptyList()).","In Kotlin, make transformation lists non-null (List<Transformation> instead of List<Transformation>?)."],"exampleFix":"// before\nList<Transformation> ts = settings.enabled() ? getTransforms() : null;\nbuilder.transform(ts);\n\n// after\nList<Transformation> ts = settings.enabled() ? getTransforms() : Collections.emptyList();\nbuilder.transform(ts);","handlingStrategy":"type-guard","validationCode":"List<Transformation> safe = transformations != null ? transformations : Collections.<Transformation>emptyList();\nbuilder.transform(safe);","typeGuard":"static List<Transformation> nonNullTransforms(List<Transformation> list) {\n  return list != null ? list : Collections.<Transformation>emptyList();\n}","tryCatchPattern":null,"preventionTips":["Helpers should return empty lists, never null, for 'no transformations'.","In Kotlin use non-null List<Transformation> types."],"tags":["android","picasso","null-safety","collections","validation"],"backgroundTag":null,"analyzedSha":"626827cddb2feb2f3aee87a52a064b4e5ca2bed4","analyzedAt":"2026-08-14T12:45:58.758Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}