Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for negative toItem variable #92

Merged
merged 1 commit into from
Jun 17, 2021
Merged

Fix for negative toItem variable #92

merged 1 commit into from
Jun 17, 2021

Conversation

tchudyk
Copy link
Contributor

@tchudyk tchudyk commented Jun 11, 2021

Sometimes when I'm using lastest RichTextFx, when I select all text in editor, and cut it (ctrl+x), there is throw exception because of negative toItem variable.

This solution probably is not perfect, but it solve this problem.

I see also here "validation" to not pass values bigger than cells.size(), so adding validations to not pass values lower then 0 make also sense.

Here is a stacktrace for this exception:

Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: [-2147483648, 1) is not a valid range within [0, 1)
	at org.reactfx.util.Lists.checkRange(Lists.java:128)
	at org.reactfx.util.Lists.checkRange(Lists.java:123)
	at org.reactfx.collection.MemoizationListImpl.forget(MemoizationList.java:184)
	at org.fxmisc.flowless.CellListManager.cropTo(CellListManager.java:86)
	at org.fxmisc.flowless.CellPositioner.cropTo(CellPositioner.java:29)
	at org.fxmisc.flowless.Navigator.cropToNeighborhoodOf(Navigator.java:254)
	at org.fxmisc.flowless.Navigator.placeStartAtMayCrop(Navigator.java:227)
	at org.fxmisc.flowless.Navigator.visit(Navigator.java:182)
	at org.fxmisc.flowless.MinDistanceTo.accept(TargetPosition.java:198)
	at org.fxmisc.flowless.Navigator.layoutChildren(Navigator.java:80)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1207)
	at org.fxmisc.flowless.VirtualFlow.layoutChildren(VirtualFlow.java:257)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1207)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1214)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1214)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1214)
	at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1214)
	at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:576)
	at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2476)
	at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:413)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:412)
	at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:439)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:563)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:543)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:536)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:342)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run$$$capture(InvokeLaterDispatcher.java:96)
	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
	at java.base/java.lang.Thread.run(Thread.java:831)

@Jugen Jugen merged commit 2f370a2 into FXMisc:master Jun 17, 2021
@Jugen
Copy link
Contributor

Jugen commented Jun 17, 2021

@tchudyk Thank you very much :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants