Prechádzať zdrojové kódy

Fix Exception.Error() output when e.val is nil and e is not

Valeriy Gorelov 1 rok pred
rodič
commit
2ac268b744
1 zmenil súbory, kde vykonal 4 pridanie a 2 odobranie
  1. 4 2
      runtime.go

+ 4 - 2
runtime.go

@@ -386,11 +386,13 @@ func (e *Exception) String() string {
 }
 
 func (e *Exception) Error() string {
-	if e == nil || e.val == nil {
+	if e == nil {
 		return "<nil>"
 	}
 	var b bytes.Buffer
-	b.WriteString(e.val.String())
+	if e.val != nil {
+		b.WriteString(e.val.String())
+	}
 	e.writeShortStack(&b)
 	return b.String()
 }