Skip to content

Commit 30cbd10

Browse files
authored
Fix panic of empty string in type reference directive (#1908)
1 parent 80e287b commit 30cbd10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/module/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func ParsePackageName(moduleName string) (packageName, rest string) {
4545
}
4646

4747
func MangleScopedPackageName(packageName string) string {
48-
if packageName[0] == '@' {
48+
if len(packageName) > 0 && packageName[0] == '@' {
4949
idx := strings.Index(packageName, "/")
5050
if idx == -1 {
5151
return packageName

0 commit comments

Comments
 (0)