Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
f7db1b98
Commit
f7db1b98
authored
Jun 20, 2012
by
Julien Michel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG: Fixing failing test due to unknown srs leading to segmentation fault
parent
72f6b1ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.cxx
Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.cxx
+17
-6
No files found.
Code/UtilitiesAdapters/OGRAdapters/otbOGRLayerWrapper.cxx
View file @
f7db1b98
...
...
@@ -233,18 +233,29 @@ std::string otb::ogr::Layer::GetProjectionRef() const
{
char
*
wkt
;
const
OGRErr
res
=
m_Layer
->
GetSpatialRef
()
->
exportToWkt
(
&
wkt
);
assert
(
m_Layer
&&
"OGRLayer not initialized"
);
OGRSpatialReference
*
srs
=
m_Layer
->
GetSpatialRef
();
if
(
res
!=
OGRERR_NONE
)
if
(
srs
)
{
itkGenericExceptionMacro
(
<<
"Cannot convert spatial reference to wkt string for layer <"
<<
m_Layer
->
GetName
()
<<
">: "
<<
CPLGetLastErrorMsg
());
const
OGRErr
res
=
srs
->
exportToWkt
(
&
wkt
);
if
(
res
!=
OGRERR_NONE
)
{
itkGenericExceptionMacro
(
<<
"Cannot convert spatial reference to wkt string for layer <"
<<
m_Layer
->
GetName
()
<<
">: "
<<
CPLGetLastErrorMsg
());
}
}
std
::
string
stringWkt
(
wkt
);
// According to documentation, argument of exportToWkt() should be freed
OGRFree
(
wkt
);
// According to documentation, argument of exportToWkt() should be
// freed
if
(
srs
)
{
CPLFree
(
wkt
);
}
return
stringWkt
;
}
...
...
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