Merge pull request #8401 from ctrlaltdavid/21026

Fix crash when adding new attachment
This commit is contained in:
Brad Hefta-Gaub 2016-08-10 09:18:17 -07:00 committed by GitHub
commit 7503a495fd
2 changed files with 4 additions and 2 deletions

View file

@ -24,6 +24,7 @@ Item {
Rectangle { color: hifi.colors.baseGray; anchors.fill: parent; radius: 4 } Rectangle { color: hifi.colors.baseGray; anchors.fill: parent; radius: 4 }
Component.onCompleted: { Component.onCompleted: {
jointChooser.model = MyAvatar.jointNames;
completed = true; completed = true;
} }
@ -82,7 +83,6 @@ Item {
HifiControls.ComboBox { HifiControls.ComboBox {
id: jointChooser; id: jointChooser;
anchors { bottom: parent.bottom; left: parent.left; right: parent.right } anchors { bottom: parent.bottom; left: parent.left; right: parent.right }
model: MyAvatar.jointNames
colorScheme: hifi.colorSchemes.dark colorScheme: hifi.colorSchemes.dark
currentIndex: attachment ? model.indexOf(attachment.jointName) : -1 currentIndex: attachment ? model.indexOf(attachment.jointName) : -1
onCurrentIndexChanged: { onCurrentIndexChanged: {

View file

@ -1638,7 +1638,9 @@ void AvatarData::setAttachmentsVariant(const QVariantList& variant) {
for (const auto& attachmentVar : variant) { for (const auto& attachmentVar : variant) {
AttachmentData attachment; AttachmentData attachment;
attachment.fromVariant(attachmentVar); attachment.fromVariant(attachmentVar);
newAttachments.append(attachment); if (!attachment.modelURL.isEmpty()) {
newAttachments.append(attachment);
}
} }
setAttachmentData(newAttachments); setAttachmentData(newAttachments);
} }