Skip to content

Commit 5420211

Browse files
committed
BUGFIX: Don't crash if the breakpoint is not in a Flow package
1 parent 14d0726 commit 5420211

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

flowpathmapper/flowpathmapper.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,21 @@ func (p *PathMapper) readOriginalPathFromCache(path string) string {
172172
}
173173

174174
func (p *PathMapper) buildClassNameFromPath(path string) (string, string) {
175-
// todo add support for PSR4
175+
var (
176+
basePath string
177+
className string
178+
)
176179
match := regexpPackageClass.FindStringSubmatch(path)
177-
basePath := match[1]
178-
className := regexpDot.ReplaceAllString(match[3], "_")
180+
if len(match) == 4 {
181+
// Flow standard packages
182+
basePath = match[1]
183+
className = regexpDot.ReplaceAllString(match[3], "_")
184+
} else {
185+
// Other (vendor) packages, todo add support for vendor package with Flow proxy class
186+
p.logger.Warn(h, "Vendor package detected")
187+
p.logger.Warn("Class mapping not supported currently for path: %s, \n", path)
188+
basePath = path
189+
className = ""
190+
}
179191
return basePath, className
180192
}

0 commit comments

Comments
 (0)