Skip to content

Commit 04b7336

Browse files
author
carm
committed
more logical fix to bug by using exist left / right args
e Please enter the commit message for your changes. Lines starting
1 parent 936ebd4 commit 04b7336

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/libprojectM/MilkdropPresetFactory/Expr.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,22 @@ float TreeExpr::eval_tree_expr ( int mesh_i, int mesh_j )
160160
/* Safe guard in case the user gave a partially written expression */
161161
if (left == NULL) {
162162
if (infix_op == Eval::infix_mult)
163-
return 1;
163+
left_arg = 1;
164164
else
165-
return 0;
165+
left_arg = 0;
166166
}
167+
else
168+
left_arg = left->eval_tree_expr ( mesh_i, mesh_j );
167169

168-
left_arg = left->eval_tree_expr ( mesh_i, mesh_j );
169-
170-
/* Safe guard */
171-
if (right == NULL)
172-
return left_arg;
173-
174-
right_arg = right->eval_tree_expr ( mesh_i, mesh_j );
170+
/* Safe guard in case the user gave a partially written expression */
171+
if (right == NULL) {
172+
if (infix_op == Eval::infix_mult)
173+
right_arg = 1;
174+
else
175+
right_arg = 0;
176+
}
177+
else
178+
right_arg = right->eval_tree_expr ( mesh_i, mesh_j );
175179

176180

177181
switch ( infix_op->type )

src/projectM-qt/qprojectm.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ class QProjectM : public QObject, public projectM {
3535
presetSwitchedSignal(hardCut, index);
3636
}
3737

38+
void presetSwitchFailedEvent(bool hardCut, unsigned int index, const std::string & message) const {
39+
presetSwitchFailedSignal(hardCut, index, message);
40+
}
41+
3842
void presetRatingChanged(unsigned int index, int rating,
3943
PresetRatingType ratingType) const {
4044
presetRatingChangedSignal(index, rating, ratingType);
4145
}
4246

4347
signals:
4448
void presetSwitchedSignal(bool hardCut, unsigned int index) const;
49+
void presetSwitchFailedSignal(bool hardCut, unsigned int index, const std::string & message) const;
4550
void presetRatingChangedSignal(unsigned int index, int rating,
4651
PresetRatingType ratingType) const;
4752

0 commit comments

Comments
 (0)