Skip to content

Commit

Permalink
You should lock mutexes before you unlock them. Thanks @jwheare!
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielOaks committed Dec 29, 2017
1 parent e858321 commit c63e15d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ircdog.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,10 @@ Options:

msg, err := ircmsg.ParseLine(line)
if err != nil {
outputMutex.Lock()
fmt.Println("** ircdog warning: this next line looks incorrect, we're not formatting it **")
fmt.Println("<- ", line)
outputMutex.Unlock()
continue
}

Expand Down Expand Up @@ -257,8 +259,10 @@ Options:

msg, err := ircmsg.ParseLine(line)
if err != nil {
outputMutex.Lock()
fmt.Println("** ircdog warning: this next line looks incorrect, we're not formatting it **")
fmt.Println(" ->", line)
outputMutex.Unlock()
continue
}

Expand All @@ -269,6 +273,7 @@ Options:
fmt.Println(" ->", ircfmt.Escape(line))
outputMutex.Unlock()
} else {
outputMutex.Lock()
splitLine := lib.AnsiFormatLineParts(lib.SplitLineIntoParts(line), useItalics)
fmt.Fprintln(colourablestdout, " -> "+splitLine)
outputMutex.Unlock()
Expand Down

0 comments on commit c63e15d

Please sign in to comment.