[Liblas-commits]
hg: null check the points before trying to destroy, properly err...
liblas-commits at liblas.org
liblas-commits at liblas.org
Wed Jan 13 12:26:37 EST 2010
changeset a406d111757b in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=a406d111757b
summary: null check the points before trying to destroy, properly error out if we eliminate all points
diffstat:
apps/las2las.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diffs (53 lines):
diff -r 617380602b5e -r a406d111757b apps/las2las.c
--- a/apps/las2las.c Wed Jan 13 10:17:39 2010 -0600
+++ b/apps/las2las.c Wed Jan 13 11:21:12 2010 -0600
@@ -667,7 +667,12 @@
fprintf(stderr,
"thinned: %d\n",
thinned);
-
+
+ if (surviving_number_of_point_records == 0) {
+ fprintf(stderr, "All points were eliminated!\n");
+ exit(0);
+ }
+
LASReader_Destroy(reader);
LASHeader_Destroy(header);
@@ -875,7 +880,7 @@
free(proj4_text);
}
- /* keep around the header's SRS if we don't have on set by the user */
+ /* keep around the header's SRS if we don't have one set by the user */
if (in_srs == NULL) {
in_srs = LASHeader_GetSRS(surviving_header);
}
@@ -1036,8 +1041,11 @@
LASReader_Destroy(reader);
LASHeader_Destroy(header);
LASHeader_Destroy(surviving_header);
- LASPoint_Destroy(surviving_point_max);
- LASPoint_Destroy(surviving_point_min);
+
+ if (surviving_point_max != NULL)
+ LASPoint_Destroy(surviving_point_max);
+ if (surviving_point_min != NULL)
+ LASPoint_Destroy(surviving_point_min);
reader = LASReader_Create(file_name_out);
if (!reader) {
@@ -1059,8 +1067,10 @@
repair_header(stderr, header, summary) ;
if (summary != NULL) {
- LASPoint_Destroy(summary->pmin);
- LASPoint_Destroy(summary->pmax);
+ if (summary->pmin != NULL)
+ LASPoint_Destroy(summary->pmin);
+ if (summary->pmax != NULL)
+ LASPoint_Destroy(summary->pmax);
free(summary);
}
More information about the Liblas-commits
mailing list