Skip to content

Commit

Permalink
Fixes #1433
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRAgostinho authored and Sérgio Agostinho committed Nov 20, 2015
1 parent 25da939 commit 036653e
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions io/include/pcl/io/ply/ply_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,19 @@ inline bool pcl::io::ply::ply_parser::parse_scalar_property (format_type format,
typedef ScalarType scalar_type;
if (format == ascii_format)
{
scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
std::string value_s;
scalar_type value;
char space = ' ';
istream >> value;
istream >> value_s;
try
{
value = boost::lexical_cast<scalar_type> (value_s);
}
catch (boost::bad_lexical_cast &)
{
value = std::numeric_limits<scalar_type>::quiet_NaN ();
}

if (!istream.eof ())
istream >> space >> std::ws;
if (!istream || !isspace (space))
Expand Down Expand Up @@ -625,9 +635,19 @@ inline bool pcl::io::ply::ply_parser::parse_list_property (format_type format, s
}
for (std::size_t index = 0; index < size; ++index)
{
scalar_type value = std::numeric_limits<scalar_type>::quiet_NaN ();
std::string value_s;
scalar_type value;
char space = ' ';
istream >> value;
istream >> value_s;
try
{
value = boost::lexical_cast<scalar_type> (value_s);
}
catch (boost::bad_lexical_cast &)
{
value = std::numeric_limits<scalar_type>::quiet_NaN ();
}

if (!istream.eof ())
{
istream >> space >> std::ws;
Expand Down

0 comments on commit 036653e

Please sign in to comment.