Skip to content

Commit c21147b

Browse files
committed
Handle platform not found errors
1 parent 4f8244a commit c21147b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arduino/cores/packagemanager/download.go

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package packagemanager
1818
import (
1919
"fmt"
2020

21+
"github.com/arduino/arduino-cli/arduino"
2122
"github.com/arduino/arduino-cli/arduino/cores"
2223
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2324
"go.bug.st/downloader/v2"
@@ -129,5 +130,8 @@ func (pm *PackageManager) DownloadToolRelease(tool *cores.ToolRelease, config *d
129130
// DownloadPlatformRelease downloads a PlatformRelease. If the platform is already downloaded a
130131
// nil Downloader is returned.
131132
func (pm *PackageManager) DownloadPlatformRelease(platform *cores.PlatformRelease, config *downloader.Config, progressCB rpc.DownloadProgressCB) error {
133+
if platform.Resource == nil {
134+
return &arduino.PlatformNotFoundError{Platform: platform.String()}
135+
}
132136
return platform.Resource.Download(pm.DownloadDir, config, platform.String(), progressCB)
133137
}

0 commit comments

Comments
 (0)