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

Problem when editing viewed circuit's appearance in VHDL code mode #1806

Open
gtxzsxxk opened this issue Jul 29, 2023 · 2 comments
Open

Problem when editing viewed circuit's appearance in VHDL code mode #1806

gtxzsxxk opened this issue Jul 29, 2023 · 2 comments
Assignees
Labels
bug Yep, that's an insect. good first issue help wanted pri std Standard importance
Milestone

Comments

@gtxzsxxk
Copy link
Contributor

Sorry to disturbing you again and again. There occurs a NullPointerException when I am clicking the small icon named "edit viewed circuit's appearance" when I am writing some VHDL. This is the console output.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "com.cburch.logisim.circuit.Circuit.getWidthIncompatibilityData()" because the return value of "com.cburch.logisim.proj.Project.getCurrentCircuit()" is null
	at com.cburch.logisim.gui.main.CanvasPainter.drawWidthIncompatibilityData(CanvasPainter.java:53)
	at com.cburch.logisim.gui.main.CanvasPainter.paintContents(CanvasPainter.java:201)
	at com.cburch.logisim.gui.main.Canvas.paintComponent(Canvas.java:524)

I simply troubleshooted and found that the problem lies in CanvasPainter.java line 104

private void drawWithUserState(Graphics base, Graphics g, Project proj) {
    final var circ = proj.getCurrentCircuit();
    final var sel = proj.getSelection();
   
    /* codes */

    final var context = new ComponentDrawContext(canvas, circ, circState, base, g, false);
    context.setHighlightedWires(highlightedWires);
    circ.draw(context, hidden);
    sel.draw(context, hidden);

The object circ is null at the beginning, then circ.draw(context, hidden) will throw a exception. I find a simple solution. It is to add a if condition to determine whether the circ is null. If so, directly return. This works.

But I am 100% not familiar with the code here, I don't know what I am doing.... So I just report this problem....
Wish you a good day.

@maehne maehne added bug Yep, that's an insect. pri std Standard importance good first issue labels Aug 25, 2023
@maehne
Copy link
Member

maehne commented Aug 25, 2023

@BFH-ktt1: Could you maybe have a look, as you are familiar with this part of the code base?

@maehne maehne added this to the 3.9.0 milestone Aug 25, 2023
@BFH-ktt1
Copy link
Collaborator

@maehne : I would love to, also to improve the speed of the simulator as reported in #1805 by @lorenzonotaro and investigated by @davidhutchens, but unfortunately due to my two master courses at EPFL and my sabatical at BFH, I will probably only have time to release a new version before semester starts. Any help is appreciated :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Yep, that's an insect. good first issue help wanted pri std Standard importance
Projects
None yet
Development

No branches or pull requests

3 participants