Commit eabcb10a authored by Austin Clements's avatar Austin Clements

Don't crash in Sym.ReceiverName for symbols like "x.x"

R=rsc
APPROVED=rsc
DELTA=2  (0 added, 0 deleted, 2 changed)
OCL=34404
CL=34406
parent c702bdd8
......@@ -52,7 +52,7 @@ func (s *Sym) PackageName() string {
func (s *Sym) ReceiverName() string {
l := strings.Index(s.Name, ".");
r := strings.LastIndex(s.Name, ".");
if l == -1 || r == -1 {
if l == -1 || r == -1 || l == r {
return "";
}
return s.Name[l+1:r];
......
......@@ -63,7 +63,7 @@ func (c *CommonSym) PackageName() string {
func (c *CommonSym) ReceiverName() string {
l := strings.Index(c.Name, "·");
r := strings.LastIndex(c.Name, "·");
if l == -1 || r == -1 {
if l == -1 || r == -1 || l == r {
return "";
}
return c.Name[l+len("·"):r];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment