1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 14:08:58 +02:00

cameo/ops.c (tool_comp_paths): don't crash if path list is empty

This commit is contained in:
Werner Almesberger 2013-09-20 17:36:16 -03:00
parent b8c927831f
commit 44d58a54fa

View File

@ -1,8 +1,8 @@
/* /*
* ops.c - Higher-level toolpath operations * ops.c - Higher-level toolpath operations
* *
* Written 2010-2012 by Werner Almesberger * Written 2010-2013 by Werner Almesberger
* Copyright 2010-2012 Werner Almesberger * Copyright 2010-2013 Werner Almesberger
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -49,6 +49,8 @@ struct path *tool_comp_paths(const struct path *paths, int dog_bone,
* explicitly tell cameo to treat the path as an outside edge. * explicitly tell cameo to treat the path as an outside edge.
*/ */
if (!paths)
return NULL;
leftmost = path_find_leftmost(paths); leftmost = path_find_leftmost(paths);
for (path = paths; path; path = path->next) for (path = paths; path; path = path->next)
if (path != leftmost && (all_inside || !path->outside)) { if (path != leftmost && (all_inside || !path->outside)) {