demo: fix infinite loop with 0 channels of one type

The following command line exhibits the inifinit loop:
  sigrok-cli -d demo:analog_channels=0 --samples=8
This commit is contained in:
Aurelien Jacobs 2016-01-28 23:17:50 +01:00 committed by Uwe Hermann
parent e922790220
commit 9dfacd8706
1 changed files with 2 additions and 2 deletions

View File

@ -784,8 +784,8 @@ static int prepare_data(int fd, int revents, void *cb_data)
*/
todo_us = samples_todo * G_USEC_PER_SEC / devc->cur_samplerate;
logic_done = 0;
analog_done = 0;
logic_done = devc->num_logic_channels > 0 ? 0 : samples_todo;
analog_done = devc->num_analog_channels > 0 ? 0 : samples_todo;
while (logic_done < samples_todo || analog_done < samples_todo) {
/* Logic */