Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dfss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mpcs
dfss
Commits
fcd05d6c
Commit
fcd05d6c
authored
May 03, 2016
by
Loïck Bonniot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[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
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
dfssc/common/file.go
dfssc/common/file.go
+5
-0
gui/showcontract/showcontract.go
gui/showcontract/showcontract.go
+2
-3
No files found.
dfssc/common/file.go
View file @
fcd05d6c
...
@@ -2,6 +2,7 @@ package common
...
@@ -2,6 +2,7 @@ package common
import
(
import
(
"encoding/json"
"encoding/json"
"errors"
"dfss/dfssp/contract"
"dfss/dfssp/contract"
)
)
...
@@ -15,5 +16,9 @@ func UnmarshalDFSSFile(data []byte) (*contract.JSON, error) {
...
@@ -15,5 +16,9 @@ func UnmarshalDFSSFile(data []byte) (*contract.JSON, error) {
return
nil
,
err
return
nil
,
err
}
}
if
c
.
File
==
nil
{
return
nil
,
errors
.
New
(
"empty file description"
)
}
return
c
,
nil
return
c
,
nil
}
}
gui/showcontract/showcontract.go
View file @
fcd05d6c
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
package
showcontract
package
showcontract
import
(
import
(
"encoding/json"
"io/ioutil"
"io/ioutil"
"dfss/dfssc/common"
"dfss/dfssp/contract"
"dfss/dfssp/contract"
"github.com/visualfc/goqt/ui"
"github.com/visualfc/goqt/ui"
)
)
...
@@ -49,8 +49,7 @@ func Load(filename string) *contract.JSON {
...
@@ -49,8 +49,7 @@ func Load(filename string) *contract.JSON {
return
nil
return
nil
}
}
contract
:=
new
(
contract
.
JSON
)
contract
,
err
:=
common
.
UnmarshalDFSSFile
(
data
)
err
=
json
.
Unmarshal
(
data
,
contract
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
return
nil
}
}
...
...
Write
Preview
Markdown
is supported
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