{"record":{"id":"2de9b0a5f7d9ea05","repo":"Unity-Technologies/UnityCsReference","slug":"clip","errorCode":null,"errorMessage":"clip","messagePattern":"clip","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/Audio/StreamedAudioClipPreview.cs","lineNumber":64,"sourceCode":"            public AudioClip clip;\n            public int previewPixelsToRender;\n            public double localStart;\n            public double localLength;\n            public bool looping;\n\n            public ClipPreviewDetails(AudioClip clip, bool isLooping, int size, double localStart, double localLength)\n            {\n                if (size < 2)\n                    throw new ArgumentException(\"Size has to be larger than 1\");\n\n                if (localLength <= 0)\n                    throw new ArgumentException(\"length has to be longer than zero\", \"localLength\");\n\n                if (localStart < 0)\n                    throw new ArgumentException(\"localStart has to be positive\", \"localStart\");\n\n                if (clip == null)\n                    throw new ArgumentNullException(\"clip\");\n\n                this.clip = clip;\n\n                preview = AudioClipMinMaxOverview.GetOverviewFor(clip);\n\n                if (preview == null)\n                    throw new ArgumentException(\"Clip \" + clip + \"'s overview preview is null\");\n\n                looping = isLooping;\n\n                this.localStart = localStart;\n                this.localLength = localLength;\n\n                if (looping)\n                {\n                    previewPixelsToRender = size;\n                }\n                else","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Audio/StreamedAudioClipPreview.cs#L46-L82","documentation":"ArgumentNullException thrown by the ClipPreviewDetails constructor when the clip parameter is null. This is the first null guard in the constructor, ensuring a valid AudioClip is provided before accessing its properties and generating a min/max overview.","triggerScenarios":"Constructing ClipPreviewDetails with clip=null. Occurs when a preview is requested for an unassigned AudioClip slot, when a SerializedProperty referencing a clip is empty, or when a container element's audioClip field has not been set.","commonSituations":"AudioRandomContainer elements with no clip assigned, inspector preview rendering before a clip is dragged in, scripted operations iterating over elements where some have null clips, asset import failures leaving clip references unset.","solutions":["Null-check the clip before constructing ClipPreviewDetails.","Skip preview rendering for elements or slots where the AudioClip is unassigned.","Guard with: if (clip == null) return; before the constructor call.","Ensure container elements have valid clips assigned before attempting preview rendering."],"exampleFix":"// before\nvar details = new ClipPreviewDetails(clip, looping, size, start, length);\n// after\nif (clip == null) return;\nvar details = new ClipPreviewDetails(clip, looping, size, start, length);","handlingStrategy":"type-guard","validationCode":"// Null-check clip before constructing ClipPreviewDetails\nif (clip == null) return;\nvar details = new ClipPreviewDetails(clip, looping, size, localStart, localLength);","typeGuard":"static bool HasValidClip(AudioClip clip) => clip != null;","tryCatchPattern":null,"preventionTips":["Null-check AudioClip references before preview rendering.","Skip preview for AudioRandomContainer elements with unassigned clips.","Guard inspector preview code with null checks on the selected clip.","Use try-get patterns when iterating container elements to handle null clips gracefully."],"tags":["audio","editor","validation","null-check","argument-validation","preview","waveform"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}