Skip to content

Commit

Permalink
Capture reason for nil reference for #45
Browse files Browse the repository at this point in the history
Also disable newer parts of raw messages for consistency
  • Loading branch information
xeals committed Dec 17, 2018
1 parent d078721 commit 602f1c1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
11 changes: 11 additions & 0 deletions cmd/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io"
"log"
"os"
"runtime/debug"
"strings"

"github.com/pkg/errors"
Expand Down Expand Up @@ -160,6 +161,16 @@ func XML(bf *types.BackupFile, out io.Writer) error {
return nil
},
StatementFunc: func(s *signal.SqlStatement) error {
defer func() {
if r := recover(); r != nil {
log.Println("Unexpected error:", r)
log.Printf("TEMP: statement is %+v\n", s)
log.Printf("TEMP: statement is %#v\n", s)
debug.PrintStack()
os.Exit(1)
}
}()

// Only use SMS/MMS statements
if strings.HasPrefix(*s.Statement, "INSERT INTO sms") {
sms, err := types.NewSMSFromStatement(s)
Expand Down
18 changes: 9 additions & 9 deletions types/raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func ParametersToSMS(ps []*signal.SqlStatement_SqlParameter) *SQLSMS {
ExpireStarted: ps[19].GetIntegerParameter(),
Notified: ps[20].GetIntegerParameter(),
ReadReceiptCount: ps[21].GetIntegerParameter(),
Unidentified: ps[22].GetIntegerParameter(),
//Unidentified: ps[22].GetIntegerParameter(),
}

return result
Expand Down Expand Up @@ -310,13 +310,13 @@ func ParametersToMMS(ps []*signal.SqlStatement_SqlParameter) *SQLMMS {
ExpireStarted: ps[39].GetIntegerParameter(),
Notified: ps[40].GetIntegerParameter(),
ReadReceiptCount: ps[41].GetIntegerParameter(),
QuoteID: ps[42].GetIntegerParameter(),
QuoteAuthor: ps[43].StringParamter,
QuoteBody: ps[44].StringParamter,
QuoteAttachment: ps[45].GetIntegerParameter(),
QuoteMissing: ps[46].GetIntegerParameter(),
SharedContacts: ps[47].StringParamter,
Unidentified: ps[48].GetIntegerParameter(),
//QuoteID: ps[42].GetIntegerParameter(),
//QuoteAuthor: ps[43].StringParamter,
//QuoteBody: ps[44].StringParamter,
//QuoteAttachment: ps[45].GetIntegerParameter(),
//QuoteMissing: ps[46].GetIntegerParameter(),
//SharedContacts: ps[47].StringParamter,
//Unidentified: ps[48].GetIntegerParameter(),
}

return result
Expand Down Expand Up @@ -396,6 +396,6 @@ func ParametersToPart(ps []*signal.SqlStatement_SqlParameter) *SQLPart {
Quote: ps[25].GetIntegerParameter(),
Width: ps[26].GetIntegerParameter(),
Height: ps[27].GetIntegerParameter(),
Caption: ps[28].StringParamter,
//Caption: ps[28].StringParamter,
}
}

0 comments on commit 602f1c1

Please sign in to comment.