Skip to content

Commit f58b461

Browse files
committed
Handle platform not found errors
1 parent c19f264 commit f58b461

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arduino/cores/packagemanager/download.go

Lines changed: 4 additions & 0 deletions
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)