Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpcs
dfss
Commits
fcd05d6c
Commit
fcd05d6c
authored
May 03, 2016
by
Loïck Bonniot
Browse files
[gui][c] Fix unmarshal when corrupted dfss json
Fix
#10
parent
87d3948f
Pipeline
#1181
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dfssc/common/file.go
View file @
fcd05d6c
...
...
@@ -2,6 +2,7 @@ package common
import
(
"encoding/json"
"errors"
"dfss/dfssp/contract"
)
...
...
@@ -15,5 +16,9 @@ func UnmarshalDFSSFile(data []byte) (*contract.JSON, error) {
return
nil
,
err
}
if
c
.
File
==
nil
{
return
nil
,
errors
.
New
(
"empty file description"
)
}
return
c
,
nil
}
gui/showcontract/showcontract.go
View file @
fcd05d6c
...
...
@@ -2,9 +2,9 @@
package
showcontract
import
(
"encoding/json"
"io/ioutil"
"dfss/dfssc/common"
"dfss/dfssp/contract"
"github.com/visualfc/goqt/ui"
)
...
...
@@ -49,8 +49,7 @@ func Load(filename string) *contract.JSON {
return
nil
}
contract
:=
new
(
contract
.
JSON
)
err
=
json
.
Unmarshal
(
data
,
contract
)
contract
,
err
:=
common
.
UnmarshalDFSSFile
(
data
)
if
err
!=
nil
{
return
nil
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment