I've reduced the crash down to something like this:
echo(search("A", ["A", "Apple"]));
A file with just this code terminates OpenSCAD on my machine [Win 7
Enterprise, 64 bit].
This seems reasonable. I'd expect to see [0] returned. Am I missing
something?
--
View this message in context: http://forum.openscad.org/search-crashes-OpenSCAD-2014-03-tp10956.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
To be clear: I mean the *code *seems reasonable, not the *crash *
--
View this message in context: http://forum.openscad.org/search-crashes-OpenSCAD-2014-03-tp10956p10958.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On Jan 8, 2015, at 14:56 PM, funnypolynomial funnypolynomial@gmail.com wrote:
I've reduced the crash down to something like this:
echo(search("A", ["A", "Apple"]));
Thanks for the report. It shouldn’t crash.
Please follow this issue: https://github.com/openscad/openscad/issues/1147
-Marius
On 01/08/2015 08:56 PM, funnypolynomial wrote:
I've reduced the crash down to something like this:
echo(search("A", ["A", "Apple"]));
It should be:
echo(search("A", [ ["A", "Apple"] ]));
Of cause it should not crash, but report the invalid search vector.
ciao,
Torsten.
Thanks. I think I see why that gets around it. It's searching the vector,
looking at each element in turn. By default it's looking at the 0th
"column" of each element (index_col_num=0), but in my case, the elements
have no columns because they're strings rather than vectors.
So
echo(search("A", [ ["A"], ["Apple"] ]));
also works.
It might be nice if search did actually handle the "degenerate" case of
column 0 and N/A columns.
On Fri, Jan 9, 2015 at 10:21 AM, Torsten Paul Torsten.Paul@gmx.de wrote:
On 01/08/2015 08:56 PM, funnypolynomial wrote:
I've reduced the crash down to something like this:
echo(search("A", ["A", "Apple"]));
It should be:
echo(search("A", [ ["A", "Apple"] ]));
Of cause it should not crash, but report the invalid search vector.
ciao,
Torsten.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 01/08/2015 10:43 PM, Mark Wilson wrote:
Thanks. I think I see why that gets around it. It's searching the vector, looking at each element in turn. By default it's looking at the
0th "column" of each element (index_col_num=0), but in my case, the elements have no columns because they're strings rather than vectors.
So
echo(search("A", [ ["A"], ["Apple"] ]));
Ahh, right, that's the other version that works :-). But search() does require a vector of vectors for the values to search in.
The fix will result in a warning message and an empty result as soon as it hits an entry that is not correct:
echo(search("F", [["A", "B", "C", "Y"], ["D", "E", "F"]], 1, 2));
// ECHO: [1]
echo(search("F", [["A", "B", "C", "Y"], ["D", "E", "F"]], 1, 3));
// WARNING: Invalid entry in search vector at index 1, required number of values in the entry: 4. Invalid entry: ["D", "E", "F"]
// ECHO: []
ciao,
Torsten.