PY-81317 Debugger fails with 'Argument for @NotNull parameter 'module' must not be null'

Merge-request: IJ-MR-173816
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>

(cherry picked from commit 726dd1849e7988d33d4937188542ba10fdb9617b)

IJ-MR-173816

GitOrigin-RevId: b84a6882c09f61d3f1b1f0500aea307a7c729edf
This commit is contained in:
Egor Eliseev
2025-08-28 10:09:35 +00:00
committed by intellij-monorepo-bot
parent e33ddb4167
commit 8bc984a12e

View File

@@ -300,19 +300,21 @@ fun TargetedCommandLine.execute(env: TargetEnvironment, indicator: ProgressIndic
* Checks whether the base directory of [project] is registered in [this] request. Adds it if it is not.
* You can also provide [modules] to add its content roots and [Sdk] for which user added custom paths
*/
fun TargetEnvironmentRequest.ensureProjectSdkAndModuleDirsAreOnTarget(project: Project, vararg modules: Module) {
fun TargetEnvironmentRequest.ensureProjectSdkAndModuleDirsAreOnTarget(project: Project, vararg modules: Module?) {
fun TargetEnvironmentRequest.addPathToVolume(basePath: Path) {
if (uploadVolumes.none { basePath.startsWith(it.localRootPath) }) {
uploadVolumes += UploadRoot(localRootPath = basePath, targetRootPath = TargetPath.Temporary())
}
}
for (module in modules) {
ModuleRootManager.getInstance(module).contentRoots.forEach {
try {
addPathToVolume(it.toNioPath())
}
catch (_: UnsupportedOperationException) {
// VirtualFile.toNioPath throws UOE if VirtualFile has no associated path which is common case for JupyterRemoteVirtualFile
if (module != null) {
ModuleRootManager.getInstance(module).contentRoots.forEach {
try {
addPathToVolume(it.toNioPath())
}
catch (_: UnsupportedOperationException) {
// VirtualFile.toNioPath throws UOE if VirtualFile has no associated path which is common case for JupyterRemoteVirtualFile
}
}
}
}