R-Lum / Luminescence

Development of the R package 'Luminescence'
http://r-lum.github.io/Luminescence/
GNU General Public License v3.0
15 stars 7 forks source link

crashes in plot_NRt() #177

Closed mcol closed 2 weeks ago

mcol commented 2 weeks ago

The following examples crash due to insufficient input validation:

plot_NRt("error")
# Error in plot_NRt("error") : object 'curves' not found
data("ExampleData.RLum.Analysis")
plot_NRt(IRSAR.RF.Data)
# Error in xy.coords(x, y) : 'x' and 'y' lengths differ
# In addition: Warning message:
# In nat[, 2]/reg[, 2] :
#  longer object length is not a multiple of shorter object length
mcol commented 2 weeks ago

Also:

data("ExampleData.BINfileData", envir = environment())
obj <- Risoe.BINfileData2RLum.Analysis(CWOSL.SAR.Data,
                                       pos = 8, ltype = "OSL")
plot_NRt(obj[[2]])
# Error in plot_NRt(obj[[2]]) : object 'curves' not found
mcol commented 2 weeks ago

Here the code doesn't correspond to the error message: https://github.com/R-Lum/Luminescence/blob/759a1142651cc557f9fd06c6b061d1aff244cdf9/R/plot_NRt.R#L145-L146 Assuming that the message is correct, we should test for if (!all(... == ...)) or equivalently for if (any(... != ...)).

RLumSK commented 2 weeks ago

I do agree, this cannot work as intended.

mcol commented 2 weeks ago

Fixed by #179.