Ver código fonte

Fix panic handler bug (#52)

Florian Weingarten 12 anos atrás
pai
commit
8db429b9dd
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4 4
      utils.go

+ 4 - 4
utils.go

@@ -16,13 +16,13 @@ func (slice int32Slice) Swap(i, j int) {
 }
 
 func withRecover(fn func()) {
-	if PanicHandler != nil {
-		defer func() {
+	defer func() {
+		if PanicHandler != nil {
 			if err := recover(); err != nil {
 				PanicHandler(err)
 			}
-		}()
-	}
+		}
+	}()
 
 	fn()
 }