T
T
tschin2015-09-29 16:15:30
Qt
tschin, 2015-09-29 16:15:30

Why does a segmentation fault occur in qtreewidget?

Hello! The program crashes on the line

if (ui->treeWidget->hasFocus() && ui->treeWidget->currentItem()->text(0).length() < 25 )

Indicates a segmentation fault.
What could be the problem? The treewidget itself doesn't seem to be empty. qt 4.8.6, Ubuntu 15.04

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly, 2015-09-29
@vt4a2h

currentItem() may return null, which is most likely the problem.

E
Eugene, 2015-09-29
@EvgenijDv

Well, if "The treewidget itself seems to be not empty", then either currentItem is empty or text(0)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question