Skip to content

Commit 0b992c4

Browse files
committed
[update] format code
1 parent d99193e commit 0b992c4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/finsh/shell.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,13 @@ int finsh_getchar(void)
162162
RT_ASSERT(shell != RT_NULL);
163163

164164
device = shell->device;
165+
if (device == RT_NULL)
166+
{
167+
return -1; /* EOF */
168+
}
165169

166170
while (rt_device_read(device, -1, &ch, 1) != 1)
167-
{
171+
{
168172
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
169173
if (shell->device != device)
170174
{

0 commit comments

Comments
 (0)