ObeoNetwork / M2Doc

The M2Doc technology enables the generation of Office Open XML documents from models.
http://obeonetwork.github.io/M2Doc/
Eclipse Public License 2.0
40 stars 22 forks source link

Make services like fit() in ImageServices robust against null inputs #521

Closed nheuermann closed 7 months ago

nheuermann commented 7 months ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please have a look to the support pages of our website : http://m2doc.org/support/

Current behavior

If services like .fit() are executed on "null", i.e. if the provided MImage does not exist (e.g. because of a property normally referencing diagrams is empty in this loop iteration), then an M2Doc error is provided.

Expected behavior

These services should just not output any error, but silently not provide any output.

Minimal reproduction of the problem with instructions

null.fit()

What is the motivation / use case for changing the behavior?

The proposal avoids the need to always put if clauses around e.g. .fit(), if it cannot guaranteed that an image is present.

jmauersberger commented 7 months ago

Accepted AND fixed in less than a day? Amazing @ylussaud !