Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
1d7aa0b9
Commit
1d7aa0b9
authored
May 20, 2015
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java jni, setObjectInfoString null string pointer fix
parent
e7a32f12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
+11
-0
No files found.
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
View file @
1d7aa0b9
...
...
@@ -224,7 +224,13 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_setObjectInfoString
char
*
s
,
*
s1
;
char
buffer
[
256
];
int
element
=
0
;
int
null_value
=
0
;
if
(
!
value
)
{
null_value
=
1
;
value
=
(
*
env
)
->
NewStringUTF
(
env
,
""
);
}
pwrtStatus_id
=
(
*
env
)
->
FindClass
(
env
,
"jpwr/rt/PwrtStatus"
);
pwrtStatus_cid
=
(
*
env
)
->
GetMethodID
(
env
,
pwrtStatus_id
,
"<init>"
,
"(I)V"
);
...
...
@@ -232,9 +238,11 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_setObjectInfoString
str
=
(
*
env
)
->
GetStringUTFChars
(
env
,
name
,
0
);
cstr
=
(
char
*
)
str
;
gdh_ConvertUTFstring
(
cstr
,
cstr
);
str_value
=
(
*
env
)
->
GetStringUTFChars
(
env
,
value
,
0
);
cstr_value
=
(
char
*
)
str_value
;
gdh_ConvertUTFstring
(
cstr_value
,
cstr_value
);
if
(
(
s
=
(
char
*
)
strchr
(
cstr
,
'#'
)))
{
*
s
=
0
;
if
(
(
s1
=
strchr
(
s
+
1
,
'['
)))
...
...
@@ -255,11 +263,14 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_setObjectInfoString
sts
=
gdh_SetObjectInfo
(
cstr
,
(
void
*
)
buffer
,
attrsize
);
}
}
if
(
null_value
)
(
*
env
)
->
DeleteLocalRef
(
env
,
value
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
name
,
cstr
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
value
,
cstr_value
);
jsts
=
(
jint
)
sts
;
return_obj
=
(
*
env
)
->
NewObject
(
env
,
pwrtStatus_id
,
pwrtStatus_cid
,
jsts
);
return
return_obj
;
}
...
...
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